This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes posting to same jsp page again Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "posting to same jsp page again" Watch "posting to same jsp page again" New topic

posting to same jsp page again

mahi tuli

Joined: May 08, 2011
Posts: 6
i am creating a jsp page in which user need to enter some option and then result will be displayed based on that option. my problem is this that my user interface and my choose tag are both on same page i had kept the action attribute of form tag empty so my page is coming back but my page is displaying all the options even the first time page is loaded and even after my selection of choice . :cry:
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3064

You need to be checking the parameters submitted by your form when you reload the page. So when the form gets submitted even if its to the same page (the action would mention which page/url to invoke) the request object would have the data from the form in its parameter map. So your target location would have to fetch these values and update the UI accordingly.
But why do you want to post to the same page? You are making the page do more than one operation which at times can be not desirable. If its a totally different operation or a different action then a new JSP should be ideal.

Mohamed Sanaulla | My Blog
Don't get me started about those stupid light bulbs.
subject: posting to same jsp page again
Similar Threads
HFS Chapter 10 Q 18 option F pg 567
how to Autosave the changes when the page is changed?
option list - where to put the jsp tag?
error showing while retrieving the data from drop down list
Ajax select boxes and browser back button