This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Struts and the fly likes all of jsp files to be passed to an action class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "all of jsp files to be passed to an action class" Watch "all of jsp files to be passed to an action class" New topic
Author

all of jsp files to be passed to an action class

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
I am new to Struts. I have some confusion.

If I want all of jsp files to be passed to an action class, how could do that ?

for example, if user type http://localhost/myapp/index.jsp, this jsp page request will go to an action class. how could I do this?

This is a good design ?

Thanks
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
The point of an MVC framework such as Struts is that all requests in an application should be made through a central control. In the case of Struts, an instance of ActionServlet serves as the control, therefore all requests should be made through the ActionServlet. By going to specific JSPs individually as you have suggested, you are defeating the purpose of MVC and instead are introducing a page-centric design.

So in general, you should never have a user access any part of your application by going to a specific JSP. One exception to this is index.jsp, which should itself forward to some Action in your Struts application (possibly through the use of <logic:forward>. Even if a particular view that you wish to present is static content that requires no setup in an Action class, you should at least use a ForwardAction as opposed to linking directly to the static content.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: all of jsp files to be passed to an action class