You could make all your links have the same URL, but put an "onclick" JavaScript handler with a different parameter on each one (most of the Struts HTML tags support the onclick, onsubmit, etc., attributes). The onclick handler does two things when you click the link:
1) sets the value of a hidden variable in the form 2) submits the form
So basically, you are turning your hyperlink into a submit button.
On the server, you now have the request parameter just as before, only now it comes from a form field instead of a query string variable.
You have to realize, though, that the value isn't truly hidden from the user (or from a network snooper) -- the user can view the HTML source to see what value gets sent with each click, and the parameter is still delivered in a request packet (though it won't show up in a URL request log). But, you won't see this parameter in a typical browser status bar when you hover your mouse pointer over the link, or in the address bar after your browser starts receiving the response.
Perhaps someone else might have another solution. This is the one that came to mind.
Erik
jj endenburg wrote:
Thank you Erik!
Actually, the information in my question was not complete. I am sorry for this... The parameter to pass from jsp-screen A to jsp-screen B should stay hidden from the end-user. This is why displaying this parameter in the URL is not possible, unfortunately. Instead of this, how can I pass this parameter within Struts, without the end-user being able to see it?
Thank you, Jan-Jaap
--- "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
http://struts.apache.org/userGuide/struts-html.html#linkWell, how about using a query string parameter in your links?
http://foo.com/myapp/bar.jsp?itemId=1 http://foo.com/myapp/bar.jsp?itemId=2
And so on?
The Struts html:link tag (or the JSTL c:url tag) can be used to dynamically create your links.
---------------------------------------------------------------------Hope that helps,
Erik
Original Message: ----------------- From: jj endenburg [EMAIL PROTECTED] Date: Tue, 8 Mar 2005 00:29:46 -0800 (PST) To: user@struts.apache.org Subject: parameter passing from one jsp-screen to another
Hi everyone,
I have the following problem: how can I pass a parameter from a jsp-screen A to a jsp-screen B within the struts-framework?
More concrete: Screen A has several clickable link instances to screen B. Each link instance has its own (dynamically calculated) parameter value to pass to screen B. This parameter is hidden from the sreen. Can someone give me a hint on how this parameter passing can be done in a handy way within struts?
Thanks, Jan-Jaap
Met vriendelijke groeten, Jan-Jaap Endenburg
__________________________________ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/
--------------------------------------------------------------------To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------mail2web - Check your email from the web at http://mail2web.com/ .
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
__________________________________ Celebrate Yahoo!'s 10th Birthday! Yahoo! Netrospective: 100 Moments of the Web http://birthday.yahoo.com/netrospective/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]