• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

passing values from jsp to struts action without showing in address bar

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I have a jsp file wherein I am iterating a list of Strings.
Each String by itself is a hyperlink which when clicked invokes a method in an action class.

I want to transfer the value of the String clicked from the jsp page to the action class without showing the value in the address bar. I am aware that using html:link enables me to transfer the parameter to the action class but it shows in the address bar.

I also tried using a scriptlet and used request.setAttribute() method to set the value of an attribute but when I retrieve the same in the action class using request.getAttribute() I encounter a NULL

How should I achieve my objective.
 
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Genuinely submit the form i.e. set these values in the form using onClick javascript method call which submits the values and retrieve the same in action.
 
Rahul Dhamecha
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shankar Tanikella wrote:Hi, Genuinely submit the form i.e. set these values in the form using onClick javascript method call which submits the values and retrieve the same in action.



These values are not to be obtained from the user. I am printing a list of items, where in each item is associated with a unique Id which is confidential. Each list is also a link in itself; so when I click on this link I am redirected to the next page depending on the confidential id I want to pass. I have used the html:link struts tag to create a link. I want to pass that confidential id upon every click.

How should I set the values in the javascript? Won't these values be treated as plain javascript variables and will not be passed on the form submit?
If possible please provide a code, I am unable to find a solution to the above
 
Saloon Keeper
Posts: 7645
178
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by "confidential id"? From who are you trying to hide it, and why? Note that POST parameters are as much open to inspection as GET parameters, they're just not part in the URL.
 
Rahul Dhamecha
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Moores wrote:What do you mean by "confidential id"? From who are you trying to hide it, and why? Note that POST parameters are as much open to inspection as GET parameters, they're just not part in the URL.



By confidential I mean, I don't want them to be seen in the url. These values are the primary values stored in my database for each of the enlisted items.

 
Tim Moores
Saloon Keeper
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The alternative to showing them in the URL is to make them hidden fields in a POST request - that provides no confidentiality either. If you need to round-trip them to the client and back to the server (instead of storing them in a server-side session), you should encrypt those values.
 
Talk sense to a fool and he calls you foolish. -Euripides A foolish tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic