• Post Reply Bookmark Topic Watch Topic
  • New Topic

Making JSP form persistent when a submit button refreshes the page

 
Niza Berg
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a `form` with multiple drop downs and a `submit` button. Based on any choices made from `DropDown` I am disabling other drop down's but right after I hit the submit button, it refreshes the page and `set` disabled drop downs to `enabled`. How can I make those drop downs disable even after the page is refreshed.
Below is my `Script`:

My `JSP` Page:

After a Submit button is hit, it calls servlet to provide the response based on those selection, hence refreshes the whole `test.jsp` How do I make the disabled value persistent
until the user doesn't change the option by itself.

My Servlet:


and this is my TestUtil.java

Please correct me if I am doing anything wrong and what is it I need to add to have it persistent.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of submitting the whole page, submit the form through Ajax (the jQuery Forms plugin makes this easy) and the page will remain unchanged. Otherwise, you need to write all the code to restore the state of the page after refresh.
 
Niza Berg
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Bear Bibeault, that completely make sense, but the disabling feature is inside a form itself, so if I still refresh the page or form, the disabled dropdowns would come back to enabled state. which is by default.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The point of using Ajax is that page does not refresh.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!