This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Which is Model and Controller in this example?

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am new to struts2. I have followed an example from www.roseindia.net.
my code goes here.

Login.java code goes here (action class)

action mapping is done in struts.xml code goes here:

I know that jsp is used for view-purpose. Now, i wanted to make out which is Model and controlloer in my above example.

Can any one please help me??

Regards,
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The controller proper is the Struts 2 filter. Struts 2 actions can act as both a model and "sub-controller". Note that the MVC pattern is a term that's somewhat abused in the web development world and the boundaries between layers aren't always as clear as they are in a pure MVC design.

As an aside, note that your comments have lead to a documentation error--the // ---- Username comment is made twice. Also, the <p> tags around the first sentence in JavaDoc comments are redundant, and make it harder to read. It's also arguable that the name of the method is in itself enough documentation. Lastly, a string's default value is already null; setting it explicitly is redundant.

Consider instead simplifying the source:



It's half the size, easier to read, and produces essentially the same JavaDoc output: simple setters and getters that perform no other function other than setting and getting values don't really need any other documentation other than their name. IMO essentially no information has been lost, and it's half the size.
[ December 23, 2008: Message edited by: David Newton ]
 
Tick check! Okay, I guess that was just an itch. Oh wait! Just a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!