Confused about jsp beans and scope

D

Dan Valero

I have been learning JSP and Beans with respect to form processing.
Noob question here:


I have a 3 page sign up process:

form1 (user info) -->
form2 (prod info) -->
Page 3 (Thank you, confirm, u/d database)


Using beans and introspection I set form1 and form2 beans to session
scope so I can use them on page 3 for updating etc.

This works ok, except if I page back from form2 to form1, change a
value, the change is never recognized. I assume setting the beans to
session scope is the culprit, but how should I do this correctly? Use
request scope then drop it in the Session manually when I have
validated it, then get it back on page 3?

thanks for any words of wisdom,

Dan
 
G

Gerbrand van Dieijen

I have been learning JSP and Beans with respect to form processing.
Noob question here:


I have a 3 page sign up process:

form1 (user info) -->
form2 (prod info) -->
Page 3 (Thank you, confirm, u/d database)

I'm not sure how you've set everything up, but a session variable
should be accessible from all pages, so that shouldn't be a problem.
It might be the form variables are returned back that reset some data.

I think it's best to use form variables to pass the user data on (not
certain about the correct html terms, but you should get the idea:

<form action="validate.jsp">
Username: <input type="value" name="user">
Password: <input type="password" name="password">
<input type="submit">
</form>

This way, in the page validate.jsp you can access value and password as
request variables:
getRequest().getParamater("user") .., etc.
You can then set them as session variable if password is right.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top