This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes doubt in using Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "doubt in using Struts" Watch "doubt in using Struts" New topic
Author

doubt in using Struts

muthu kumaran
Ranch Hand

Joined: Oct 26, 2004
Posts: 56
Hi
I am new to struts and have some basic doubt in using it.
I have read that the first point of contact in struts should be
the controller servlet.

But , what if I need a page to collect some information from the user
Can I directly call the page (say input.jsp) or should I go thro a
dummy xxxAction servlet which will forward to the "input.jsp"

Can anyone enlighten me on this

Thanks
Muthu
Jason Moors
Ranch Hand

Joined: Dec 04, 2001
Posts: 188
The reason for using Struts is to apply a Model 2 paradigm where the controller handles all request, therefore calling JSP pages directly is discouraged.

The ActionServlet is responsible for intercepting requests and provides additional functionality such as providing message resource bundles.

You don't need to create a dummyAction there is a built-in struts action called org.apache.struts.ForwardAction for performing this task.

Jason.
Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
Another reason for discouraging direct link to JSP is that ActionServlet must be invoked in order for Struts to load module specific message resources. So, directly linked JSP may fails if it has custom tag the uses message resource of other modules.
muthu kumaran
Ranch Hand

Joined: Oct 26, 2004
Posts: 56
Thanks Alec and Jason
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: doubt in using Struts
 
Similar Threads
~ doubt of apply ajax into struts ~
doubt in forwarding
General doubt
Struts2 Reponse already committed errors in was6
JSP Doubt?