Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

struts - how to solve problem of URL parameter?

 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, good day , i have a question on struts ..i have an action , which after completed process will then forward to a page which contain multiple form in a page(tabbed form), in order to display correct form to user , i might need some URL parameters to help select the correct form, it will however look like '/WEB-INF/results/result1.jsp?showform=2' as mappingforward..i might also need to have several similar kind of mappingforward for '/WEB-INF/results/result1.jsp?showform=1' , showform=3 ...etc

can someone guide me how to write the forward? i using following way but is not working



or someone guide me the proper way to settle this problem ...thank you very much for your time
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 35977
422
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alvin,
Struts forwards aren't really designed to pass data through parameters.

A better approach is to have your action store the value as an attribute in the request:
request.setAttribute("showForm", new Integer(2));

The JSP can then get this value and render the appropriate form.
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, Jeanne Boyarsky ...it really help ..thank you
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!