Preserving and Displaying data after form submission

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anju07
    New Member
    • May 2007
    • 12

    Preserving and Displaying data after form submission

    hi,
    Im using tabs in my jsp form, so, after i add the form details in tab1 of the form and save it, i want the details to be visible in the fields though in a read-only format. But, after saving the details disapperar, how can make it stay?

    Please help!
  • sumittyagi
    Recognized Expert New Member
    • Mar 2007
    • 202

    #2
    Originally posted by anju07
    hi,
    Im using tabs in my jsp form, so, after i add the form details in tab1 of the form and save it, i want the details to be visible in the fields though in a read-only format. But, after saving the details disapperar, how can make it stay?

    Please help!
    set the values you get on servlet to attributes in request.
    eg. request.setAttr ibute("frstTxt" , request.getPara meter("abcTxt") );

    and on jsp you can write:
    <input type="text" name="abcTxt" <% if(request.getA ttribute("frstT xt")!=null){% >
    readonly value="<%=reque st.getAttribute ("frstTxt")% >" <%}%> >

    Comment

    • anju07
      New Member
      • May 2007
      • 12

      #3
      Originally posted by sumittyagi
      set the values you get on servlet to attributes in request.
      eg. request.setAttr ibute("frstTxt" , request.getPara meter("abcTxt") );

      and on jsp you can write:
      <input type="text" name="abcTxt" <% if(request.getA ttribute("frstT xt")!=null){% >
      readonly value="<%=reque st.getAttribute ("frstTxt")% >" <%}%> >

      Hi, it worked fine...it is displaying, but, i have a few fields in my form [ ex: date,time ] where i am displaying the current date and time automatically by default when a user logs in, and if desired he is allowed to change, so at any cost those values would be displayed, also, the field would never be equated to null to satisfy that condition,
      How can i handle this?

      Comment

      • sumittyagi
        Recognized Expert New Member
        • Mar 2007
        • 202

        #4
        Originally posted by anju07
        Hi, it worked fine...it is displaying, but, i have a few fields in my form [ ex: date,time ] where i am displaying the current date and time automatically by default when a user logs in, and if desired he is allowed to change, so at any cost those values would be displayed, also, the field would never be equated to null to satisfy that condition,
        How can i handle this?
        You are not at all clear what you wanna do. But for prepopulating data, the way I told you will work. Now if it gets from database then set the values as attributes. Search for those attributes on the page. if not found then populate it with current date and time.

        Comment

        Working...