Passing params in a hyper-link, and NOT as request parameters
Mallika R Kumar
Ranch Hand
Joined: Jan 21, 2004
Posts: 38
posted
0
Hi, I have an object that I iterate over, and generate rows of hyper-links in my jsp page. The way I'm constructing the href is: in a for loop, I have the following: <a href="/userShow.do?userValue="+dataList.get(i)%>" > <%=dataNameList.get(i)%></a>
A user sees a list of names, and clicking on any one of them will take them to userShow.do action, where they can see its details. But, the resulting page displays the userValue in the address bar, which is a sensitive piece of information.
What is the best way to pass the value from a loop, in a href, to the next action ?
Any response will be helpful.
Thanks, Mallika.
Steven Bell
Ranch Hand
Joined: Dec 29, 2004
Posts: 1071
posted
0
I think you have to use hidden fields and do a post rather than a get.
Franck Tranchant
Ranch Hand
Joined: Aug 07, 2003
Posts: 75
posted
0
Hi
You consider "userValue" as a sensitive piece of information and you use it as hypertext link label ??
Doesn't make sense to me...
Maybe use a "userId" instead of a full name then retrieve the associated "userValue" right in the "userShow" Action. Or use a Form submit with hidden field for each row as proposed by Steven. Or use a frame at your application top level to 'hide' actual Actions requests from address bar.
Franck<p>--------------------
Mallika R Kumar
Ranch Hand
Joined: Jan 21, 2004
Posts: 38
posted
0
Hi, Thanks for the responses. If I use a hidden input in the loop, then my actionform bean contains a list of values for the field, and picks the first value. This is not what I want to accomplish. How can I use post method, if I want to pass user values being generated dynamically in the loop ? If there were a submit button, and the dynamic value that needed to be passed for a field was not coming from a loop, then hidden input makes sense. But, based on the link a user clicks, I need to send that link's value. Other option is for me to have a key value mapping, for the name clicked on and its value, then populate my bean with this value, and do processing. Will <html:link> pass values to my bean from the loop ? What is the best way to do this ?
Mallika.
Anil Sadi
Greenhorn
Joined: Jan 09, 2001
Posts: 23
posted
0
Hi,
The follwing approach may help you:
<script language="javascript"> function enableLink(userValueParamValue) { document.linkForm.userValueParam.value=userValueParamValue; document.linkForm.action="/userShow.do"; document.linkForm.submit(); } </script>