Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is this possible. forward to a servlet

 
Chris Pat
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
Is it possible to use mapping.findforward("servlet") where servlet is as indicated? Why cant it be parameterized? I assume I can only pass params in the session. I know Actions turn into Servlets, but I have never seen any examples of a servlet being called this way. tia.
 
alan do
Ranch Hand
Posts: 354
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
findForward() takes a String that references a forward mapping in the struts-config.xml. so no, you can't just pass a servlet into there, but rather have the forward mapping mapped to the servlet. action > forward mapping > servlet.

btw, actions don't 'turn into servlet'. they are more like request handlers. struts has 1 servlet, ActionServlet, that is the primary controller of the web application.
 
Chris Pat
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, however what would the syntax in the struts-config be? I cant get the path attribute correct.
Originally posted by alan do:
findForward() takes a String that references a forward mapping in the struts-config.xml. so no, you can't just pass a servlet into there, but rather have the forward mapping mapped to the servlet. action > forward mapping > servlet.

btw, actions don't 'turn into servlet'. they are more like request handlers. struts has 1 servlet, ActionServlet, that is the primary controller of the web application.
 
alan do
Ranch Hand
Posts: 354
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
where you define your forward inside the action-mapping or global forward, do <forward name="goToMyServlet" path="/myServlet"/>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic