aspose file tools*
The moose likes Struts and the fly likes Mapping a main Action Servlet to other servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Mapping a main Action Servlet to other servlets" Watch "Mapping a main Action Servlet to other servlets" New topic
Author

Mapping a main Action Servlet to other servlets

vernon mweetwa
Greenhorn

Joined: Nov 26, 2004
Posts: 24
hi,

I have a program that is used to generate a number of reports. The initial JSP has a number of combo boxes where a user chooses the type of report to generate, startdate and enddate.When the JSP is submitted, the main Action Servlet should now use case statement in determining which specific servlet to call so that execution happens and the result of this specific servlet be now forwarded to a JSP.This means that for every report selected, it has its own servlet to populate the result. in diagrammatic form i need to implement something like:

initial JSP- main action servlet- specific action servlet - final JSP.

How do i use the mapping.findForward method in the main servlet to forward to a specific servlet based on what kind of report has been chosen, so that that servlet can do the manipulation before results are sent to the final JSP.

Thanks
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
You don't need to mess around with the ActionServlet to do what you are trying to accomplish. First make sure all your servlets are set up in your web.xml. For example let's say you have the following:



Next add them as forwards, either global or local to an action, in your srtuts-config.xml. I'll use global forwards to demonstrate.



Now create an Action that your JSP form will submit to. It's inside this Action where you determine what Servlet to use based on the input from the form.



Based on what I understood from your post, this is the "Struts" way to solve the problem you have described.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mapping a main Action Servlet to other servlets