wood burning stoves 2.0*
The moose likes Struts and the fly likes Which is Model and Controller in this example? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Which is Model and Controller in this example?" Watch "Which is Model and Controller in this example?" New topic
Author

Which is Model and Controller in this example?

Aditi Gandy
Ranch Hand

Joined: Apr 23, 2008
Posts: 37
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,


Thanks & Regards,
Author
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Which is Model and Controller in this example?
 
Similar Threads
problems in validation part of struts 2
NullPointerException at the SessionFactory create line.
validation using Resource Bundle
problems validation.xml in struts 2
Struts 2 'dojo is not defined' .....?