But currently, my struts2 piece will forward the request based on certain criteria.
In this case if these conditions are true then control goes to some page, say apples.jsp. But this jsp page has scriplet code and expects certain parameters. Previously, before my struts2 code, these parameters were passed as 'hidden' values via JS form submission and forwarding from page w/out showing user anything.
ok so I am wondering if its possible to setParameter using struts2?
I have something like this code
I looked around and it seems the javaservlet API's do not allow setParameter as its not job of a servlet but of a HTTP request.
A way around it would be for me to pass parameters by appending them to the page name using ?param=blah but that wont be 'hidden'. Also if I wish implement this approach, then is there a way to establish a variable that could be used in struts.xml? so my struts.xml would become something like this
Thanks and sorry for big post
Joined: Jun 04, 2007
after a bit of reading up one viable solution is doing something like this
in the above, color, is a property in Fruits class. But still this parameter will be passed through url?parm=red which isnt hidden..
if someone can find a solution so the parameter is hidden i'd appreciate it.
I don't know a way to do it that hides the variables, but it is certainly possible to specify a variable for a Struts 2 result. You'll see some examples of this in the struts.xml file inside the struts 2 Showcase war file that comes with the download. Example:
In the above code, myVariable represents a property of the Action class.