Originally posted by Rob Lynn:
newPage = "/RequirementList";
request.getRequestDispatcher(newPage).forward(request, response);
Alco-Haul: We move spirits.
Demented Deliberations of a Dilettante
“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
Alco-Haul: We move spirits.
Demented Deliberations of a Dilettante
Originally posted by Rob Lynn:
The direct browser URL really doesn't matter because it has nothing to do with this servlet. I had everything working through the web.xml before using these urls and what I really wanted is to move this control out of web.xml and into a servlet. If everything still has to be declared in web.xml then I may as well stick with my original code and skip the 'controller.'
BTW, thanks for all your help!
Alco-Haul: We move spirits.
Demented Deliberations of a Dilettante
Originally posted by Rob Lynn:
In other words, in order to use the RequestDispatcher for a servlet (I have successfully forwarded to many jsps in other parts of the application) the servlet must be registered in web.xml with both a <servlet> and <servlet-mapping>?
Yes.
Do people who use a servlet in the MVC design pattern to control which servlet to forward to use a RequestDispatcher or some other means to forward control that does not require each servlet to be declared in web.xml?
Struts does not use RequestDispatcher to forward control to Actions. In fact, the Struts Controller retains its thread until the Action is done with it's processing and then it (the Controller) decides which view JSP to forward to.
Do they forward to servlets which extend HttpServlet?
They don't forward to Actions. They delegate to actions. Actions do not extend HttpServlet, they extend the struts Action class (org.apache.struts.action.Action).
I have not seen any good solid examples so far, especially containing the url in the example (I have seen some which read from some non-existent file... and go to a non-existent servlet) - do you know of any examples I can look at?
Alco-Haul: We move spirits.
Demented Deliberations of a Dilettante
Try 100 things. 2 will work out, but you will never know in advance which 2. This tiny ad might be one:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|