Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help????????  RSS feed

 
Kumaran Sowrirajan
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am having one button and combo box.combo is filled with database values.if i select the combo value and then click the button then i am putting that selected data in session variable.i am using HttpSession.then i retrieved the data from the session and then displayed in the page.
suppose if i click the browser refresh button the value which is selected recently is keep on adding in session and displayed in the page.actually what i want is if i click the browser refresh button i dont want to add the same value again and again.
if anybody didnt understand this concept can u tell me i will respond it clearly.
Thanks and Regards
Kumaran.S
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Posting an example of your code would make it easier for us to help you. I can think of two or three ways you MIGHT be causing this to happen, but only you have the information to tell us exactly what you are doing...
Kyle
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is probably happening (and this is without viewing your code), is that you GET the data to your page (or servlet?), and because that data is now in the address bar...
http://localhost:8080/examples/yourPageName.jsp?comboValue=one

When you refresh this page, you are asking for the page again, and you are also sending that selection again. There is no real way around this from the client side.

If you are using a servlet on the server side, you could use response.sendRedirect("/yourPageName.jsp") with no ?comboValue=one. This returns you to the page, and your address bar will only contain yourPageName.jsp -> as if it was your first time there. So if you refresh this page, all you are doing is requesting the plain jsp again, and not in fact, resubmitting anything on the address bar.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!