tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darren Lee Deliang" <just_dar...@hotmail.com>
Subject Re: Help me !
Date Wed, 12 Jul 2000 12:15:28 GMT
I solved the Null pointer thing by calling the constructor of the java bean!

<%StaffRecords.StaffRecords(); %>

But it is crazy to me, why all the other java beans in the other jsp pages 
do OK without me calling the constructors and in this case i need to????

I thought that the <jsp: useBean> thing finds, instantiates and creates a 
bean of the name i supply???? or izzit one thing i did in the past?

I saved the java bean by accident in my jsp folder instead of my web-inf 
folder. However I spotted it and saved it in my web-inf folder. However, 
since then i see no trace of it in my jsp folder and everything is in my 
web-inf folder but i suspect this is the reason so? any1?

Darren


>From: "ALEXANDROS  KOTSIRAS" <ALEXANDROS_K@prodigy.net>
>Reply-To: tomcat-user@jakarta.apache.org
>To: <tomcat-user@jakarta.apache.org>
>Subject: Re: Help me !
>Date: Wed, 12 Jul 2000 00:02:51 -0400
>
>Yes you can reuse the same connnection in different methods whtithin the
>same dbBean or JSP (you should not have Connections inside JSP though) . 
>You
>can then loop through multiple ResultSets (and this should probably be in
>your JSP file)  by using the same connection. In the end of you JSP close
>(or free to your Pool) Connection-PreparedStatemets-Resultsets.
>You can even reuse the same PreparedStatemt with multiple ResultSets, I
>always do  preparedStatement.clearParameters() before i reuse it but it
>might not be necessary
>But in this case you won't be able to loop through your first Resultset if
>you reused the same PreapredStatement to create a second ResultSet. This is
>usefull if your first Query returns only 1 row so that you can retrieve the
>values before reusing the PreparedStament , or if your first SqL is
>Insert/Update/Delete and does not produce a ResultSet at all.
>
>
>
>
>
>----- Original Message -----
>From: Darren Lee Deliang <just_darren@hotmail.com>
>To: <tomcat-user@jakarta.apache.org>
>Sent: Wednesday, July 12, 2000 7:17 AM
>Subject: RE: Help me !
>
>
> >
> > I did declare the con as :
> >
> > private Connection con = null;
> >
> > but it posed no problems in my other jsp pages..
> >
> > Another qn, is it possible to establish only one Connection object to my
>db
> > (con) and use it for different methods in my class? for example method A
> > wants to access and read some data from Table A in my db while method B
>will
> > access and WRITE to Table B in my db. Can I use the same con or do I 
>need
>to
> > declare several?
> >
> > Darren
> >
> > >From: Bob Byron <bbyron@MailAndNews.com>
> > >Reply-To: tomcat-user@jakarta.apache.org
> > >To: "Darren Lee Deliang" <just_darren@hotmail.com>,    tomcat-user
> > ><tomcat-user@jakarta.apache.org>
> > >Subject: RE: Help me !
> > >Date: Tue, 11 Jul 2000 12:03:28 -0400
> > >
> > >I would suspect your variable "con" is null.  If you want a quick 
>check,
>I
> > >would insert System.out.println("Connection=" + con); before line 253.
> > >
> > >If it displays "Connection=null", you will want to reexamine the
> > >initialization of con.
> > >
> > >------------------------------------------------------------
> > >Bob Byron
> > >RAD Systems, Inc.
> > >(972)516-4256
> > >
> >
> > ________________________________________________________________________
> > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
> >
>

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


Mime
View raw message