• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt in using Struts

 
muthu kumaran
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Alec and Jason
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic