• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Form values remain in URL

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I hope I can explain this....

I have created portlet with a for to add a value
<FORM>
 
Gary Seibold
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wasn't done descriping this...
<FORM>
<INPUT TYPE="text" NAME="ssn">
<INPUT TYPE="submit" NAME="todo" VALUE="ADD">
</FORM>

When the form is submitted I check to see if todo equals ADD and save the value in ssn.

Works ok but when the page is refreshed or another portlet is clicked or submitted, todo still equals ADD and ssn still has a value even tho it is blank on the screen. I think the parameters are stored in several URLs on the page so they hold their value. So I end up with the same ssn bein added many times. How can I prevent this or not have those parameters in URLs?

Thnaks.
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gary,
You have a few ways of dealing with this:
1) Use <form action="post". This won't stop the user from submitting twice, but at least they will be prompted. I suggest doing this anyway, even if you adopt another solution.
2) Store a token in the session when this page is displayed. When the user adds the SS#, delete the token. Only add if the token is there.
3) SS# is unique. You could do a query to see if the SS# is already in your database.
[ November 08, 2004: Message edited by: Jeanne Boyarsky ]
 
Jeanne Boyarsky
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch! I've submitted a post without being done quite a few times myself. In fact, it happened right in this thread. Note that we have an edit button (the white rectangle with a pencil) for if this happens in the future.

Since there isn't anything Oracle specific about this question, I'm moving it to our Servlets forum. (This problem occurs all the time, not just in portlets.)
reply
    Bookmark Topic Watch Topic
  • New Topic