Announcement Announcement Module
No announcement yet.
retaining selected value of Drop Down Box Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • retaining selected value of Drop Down Box


    I have a simple user registration form (register.jsp) with some textboxes and dropdown boxes. All the user info. is collected using a java class "User". I am able to bind the User class with "register.jsp" using a servlet "". I want to retain values inside the textbox and dropdown box after the page postback i.e. when form reloads after submit (may be to show some errors like "compulsory fields kept blank by user etc..) So far I am able to retain values of textbox using <spring:bind path="">
    tag and ${status.value} expression. But this approach does not work for the dropdowns. Dropdown resets itself to the default(0 th) value after postback.
    How to retain selected value of a dropdown? and also for radio buttons and checkboxes?

    Further I am using an enum for drop down choices. So how to bind enum with the HTML/JSP drop down tags i.e. select tag?

    Thanks in Advance