File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Parameters" Watch "Parameters" New topic


Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I'm new in JSP's so I need a lot of advice..
I'm trying to validate a user from a JSP, asking for an id_user, and a password. For validation I had accessed the database thru a class called : CL_Conection that I imported.. but my problems become after I validate the user:
[*]when I try to open a new navigator window (which the user has the permission to see) and close the existing one.
[*]when I try to pass (parameter) the id_user to the new navigator window (that could be another jsp?)
I don't want to pass the parameter thru the URL because I have heard it's not safe.. So, is there another way to pass the parameter to another JSP?
Help me please!!
What do I need to do to solve these problems?
Could you give me a hint with some code?
Thank you very much!!
Angela Poynton
Ranch Hand

Joined: Mar 02, 2000
Posts: 3143
Your problem could be that your new window doesn't have access to the session the origional window has.
Why open a new window and close down the original? Why not just forward onto a new page in the same window??

Pounding at a thick stone wall won't move it, sometimes, you need to step back to see the way around.
Erik Pragt
Ranch Hand

Joined: Sep 08, 2001
Posts: 125
And why not use a session to store the information you need, instead of using a URL?
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
You are right! Maybe I don't need to open a new window, so I have to do:
to load another jsp in the same window, don't I?
But, how can I access the form's components of the first JSP? because I need to know the id_user that is in the first one JSP...
How can I implement the sesions? (code)
Help!! or if you want, could you give me some links to JSP pages (no SUN) to learn more?
Thanks in advance...
Hari Haran

Joined: Sep 21, 2000
Posts: 19
Hi Nancy,
I have given a sample code for validating and storing values in session.

String login = request.getParameter("login");
String passwd = request.getParameter("passwd");



catch(Exception e)
out.println("Exception :"+e.toString());

In subsequent pages just use
String str_Login =(String)session.getValue("Login");
to retrieve the Login.
U can put as many values in session which can be available throughout the user session.
When the user logs off use session.invalidate();
to clear all the values from the session.
Hope this solves ur problem.

"Life is too Wonderful to be Spent worrying"
I agree. Here's the link:
subject: Parameters
It's not a secret anymore!