This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma 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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "doubt in using Struts" Watch "doubt in using Struts" New topic

doubt in using Struts

muthu kumaran
Ranch Hand

Joined: Oct 26, 2004
Posts: 56
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

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.

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
I agree. Here's the link:
subject: doubt in using Struts
It's not a secret anymore!