• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to do a preview page for submitted form

 
vanan saravanan
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is what i plan to acheive. A page with a form (eg.textfield). When the user enters his name into the textfield and clicks submit. He is brought to a page which shows his name with two buttons. One button is confirm. The second button is edit.

1) The confirm button will then save the data into a mysql database.

2) The edit button brings the user back to the form page, where the user can then make changes. The data entered into the textfield, and radio buttons must still remain there.


How do i go about executing something like the above.
 
kwame Iwegbue
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
one way would be to store the value from your textfield in a session object with session.setAttribute("value", obj) then your servlet can direct it to result.jsp, edit.jsp etc. finally with "Save" button, your servlet can save it to the database.
 
vanan saravanan
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, i 'm able to do that. Using sessions to hold the variables. How do i ensure that when i go back to the edit page, the textfields and radiobuttons still hold the session values and are not empty. As i dont want the user to type all over again but to just edit maybe a spelling mistake.
 
vanan saravanan
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok i have figured out the textfield part.

<input type="text" name="example" value="<%=blanknull(example)%>">

But how do i do it for radio buttons?
 
kwame Iwegbue
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it's the same way. If you can create a javaBean to hold the variables you need to keep track off- like the name, radio button question, select options etc. Then instead of storing individual strings like "name" etc in session bean, you store the whole javaBean in the session.

Then use a branching statement to determine which one gets selected


[ June 15, 2006: Message edited by: kwame Iwegbue ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34656
366
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This looks to be more about the web layer than JDBC so I'm moving it to our JSP forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic