It's called "action chaining". It's certainly possible, and this link explains how. You will also note from the link that it's not recommended. If you have logic in one action that another needs to use, it's better to extract the logic to a utility class or business delegate where both actions can access it than to chain actions together. [ March 24, 2006: Message edited by: Merrill Higginson ]
What also complicates this is that the servlet will be used to handle file uploading i.e. using "multipart/form-data" so when the servlet does a forward using something like "dispatcher.forward(request, response);" the receiving action generates the warning "One of the getParameter family of methods called after reading..." which I believe there is no way around as struts uses the getParameter() internally & you can't stop it?
I was hoping (when I can get hold of a forward that is) to use the redirect="true" attribute to generate a new request that not multi-part!
Hope this makes some sense mate, this has been driving me crazy for weeks!
P.S I should have said to start with I'm using Struts 1.2.7, Weblogic 8.1 (sp3) - no idea if that makes any difference though?
Joined: Feb 15, 2005
If you want to call a Struts action from a Servlet, I suggest you use response.sendRedirect() rather than requestDispatcher.forward(). The forward method redirects to a physical file, while sendRedirect instructs the browser to go to a different URL. A sendRedirect is processed exactly as if the user had entered the URL from a browser. The one thing you need to be aware of, though, is that with a sendRedirect, the HttpServletRequest object is not passed along, so any information you want to be passed to the URL must be passed in the form of parameters in the query string.