[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index] [Home]

RE: problem with beans


Title: problem with beans
Hi.
 
obj is not initialised in testBean. Try something like:
 
private xyz.xyzBean obj = new xyz.xyzBean();
 
    - Ben Kelley.
-----Original Message-----
From: Kiran Kumar R [mailto:kiranr@dcons.com]
Sent: 19 January 2001 11:49
To: 'gnujsp@gjt.org'
Cc: 'gnujsp-ann@gjt.org'
Subject: problem with beans

gnujsp/Ann,

my beans:

package test;
class testBean
{
        private xyz.xyzBean obj;
        public String methodA
        {
              return "hello";
        }

        public String methodB
        {
              String b=obj.methodX();
              return b;
        }
             
        public String methodC
        {
              String c=obj.methodY();
              return c;
        }



}

package xyz
class .xyzBean
{

        public String methodX
        {
              return "hello from xyzBean";
        }

        public String methodY
        {
              //String value returned is retrieved from the database all within this method.

        }

}

above beans are complied from  mybean directorey

repositories settings :
repositories=E:\gnujsp-1.0.1\mybean

-classpath settings:
servlet.gnujsp.initArgs=compiler=builtin-javac -classpath "%classpath%;%scratchdir%;E:\gnujsp-1.0.1\lib\gnujsp10.jar;E:\gnujsp-1.0.1\mybean" -d "%scratchdir%" -deprecation "%source%"

my jsp:

<jsp:useBean id="obj" class="test.testBean"/>
<%

String str=obj.methodA();
out.println(str);
//working
//but
String str=obj.methodB();
out.println(str);
//Does not work

//Null Pointer Exception raised

//also
String str=obj.methodC();
out.println(str);
//Does not work
//Null Pointer Exception raised
%>

an early replay will be appreciated




Regards
Kiran kumar.r
Datacons Private Limited
#17/1, Hosur Road
Bangalore - 560 068
India

Phones  : 91-80-572 3233 / 572 4919 / 572 5255 / 56 / 57
Fax             : 91-80-572 5258
Website         : www.dcons.com
Extn - 210


Visit our website at http://www.ubswarburg.com

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.