File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes How to do a preview page for submitted form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to do a preview page for submitted form" Watch "How to do a preview page for submitted form" New topic
Author

How to do a preview page for submitted form

vanan saravanan
Ranch Hand

Joined: Jun 02, 2006
Posts: 95
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

Joined: Sep 02, 2000
Posts: 197
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.


Who dares, wins! (SAS motto)
vanan saravanan
Ranch Hand

Joined: Jun 02, 2006
Posts: 95
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

Joined: Jun 02, 2006
Posts: 95
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

Joined: Sep 02, 2000
Posts: 197
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29261
    
140

This looks to be more about the web layer than JDBC so I'm moving it to our JSP forum.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to do a preview page for submitted form
 
Similar Threads
which Struts tag?
j2me - RMS & appending textfield
struts: how to list and update data
Verfiy/ Preview form data before submitting.
Radio Buttons