hi roland.

just an idea: seems to me like you are trying to access an attribute pwd in
an object Login which is stored in the session. maybe it works if you
retrieve the object itself from the session and then access it�s pwd
attribute. if you stored it in a numeric attribute you wouldn�t have to
worry about how to change it into a numeric type...

[your_class] login = ([your_class]) session.getAttribute("Login");
...

then you can access it with login.pwd when you need it.

if you stored pwd in your database as a numeric value you shouldn�t put it
in "'" in your select-statement either...

hope this helps!




                    Roland Dong
                    <[EMAIL PROTECTED]>        An:     [EMAIL PROTECTED]
                    Gesendet von: A          Kopie:
                    mailing list             Thema:  How to get the Session value and 
use it for
                    about Java Server        DB access?
                    Pages
                    specification and
                    reference
                    <JSP-INTEREST@jav
                    a.sun.com>


                    24.04.2001 17:35
                    Bitte antworten
                    an A mailing list
                    about Java Server
                    Pages
                    specification and
                    reference






Please help with the following problem.
(I am using Orion 4.7)

I am trying to use the value of the session variable for database
accesses( I am not concerned about security).

First, I tried to get the session value back in  b.jsp  by:
String pwd =(String)session.getAttribute("Login.Password");

and then use pwd to query oracle DB by:
rs = stmt.executeQuery("SELECT * FROM customers WHERE password
='"+this.pwd+"'");


I got this error message:

Syntax error in
source/jsp/db_proj/BillingDB/jsp_servlet/myAcct.jsp.java:92:
No variable pwd defined in class
/jsp/db_proj/BillingDB/jsp_servlet/myAcct.jsp. (JSP page line 122)
           rs = stmt.executeQuery("SELECT * FROM customers WHERE CUSTID
='"+this.pwd+"'");

^
1 error

My questions are:

1. How do I define pwd. Why can't "String pwd
=(String)session.getAttribute("Login.Password");" define pwd? I tried to
put
it into <%! %> then I got another
error message saying variable "session" is undefined...

2. Since password is a number type, how do I change pwd into an number
type?

3. What is the solution?

Thanks in advance.

Roland

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to