Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Form values remain in URL

 
Gary Seibold
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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.)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic