dcsimg
Problems with Beans and String
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mujtaba_Ahmed
Posted On:   Wednesday, September 25, 2002 01:15 PM

1. Can I use more than one bean in a jsp. 2. Login bean is associated with more than one jsp. It contains a username and password fields as strings. If I want to retrieve this username in the last jsp it's returning an empty string. How can I get the value of username which is entered in first jsp page, in the last jsp. Is it related to bean's scope? 3. I am getting an empty string i.e. 'finaldate' and I don't know why and how should I debug it's value. Here is the code which supposed to return a string with a date. ResultSet pq=stmt.executeQuery("select CURRENT_DATE"); if(pq.next()) idate=pq.getString("CURRENT_DATE"); finaldate=membean.calc(idat   More>>


1. Can I use more than one bean in a jsp.



2. Login bean is associated with more than one jsp. It contains a username and password fields as strings. If I want to retrieve this username in the last jsp it's returning an empty string. How can I get the value of username which is entered in first jsp page, in the last jsp. Is it related to bean's scope?



3. I am getting an empty string i.e. 'finaldate' and I don't know why and how should I debug it's value.
Here is the code which supposed to return a string with a date.



			
ResultSet pq=stmt.executeQuery("select CURRENT_DATE");
if(pq.next())
idate=pq.getString("CURRENT_DATE");
finaldate=membean.calc(idate2);
int rowsAffected=stmt.executeUpdate("insert into reserve(mem_id,book_id,startdate,lastdate) values('"+name+"','"+id+"','"+idate+"','"+finaldate+"')");
   <<Less

Re: Problems with Beans and String

Posted By:   Christopher_Koenigsberg  
Posted On:   Wednesday, September 25, 2002 01:32 PM

1. Yes of course.



2. Yes the bean has to be in "session" or "application" scope because they are shared between JSP's, while "page" and "request" are not shared.



3. You are setting "idate" (pq.getString), but then using "idate2" (membean.calc) to set "finaldate", are these really 2 different variables?

About | Sitemap | Contact