tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander ten Bruggencate <a.ten.bruggenc...@home.nl>
Subject Re: aaargh..
Date Thu, 16 Nov 2000 08:25:48 GMT
William Brogden wrote:

> Alexander ten Bruggencate wrote:
> >
> > for the past 3 days i've been trying to get a jsp to work with an ejb of
> > mine.
> > the only problem is that <jsp:setProperty ..../> and <jsp:getProperty
> > ..../> won't work.
> >
> > tomcat reports: org.apache.jasper.JasperException: Attempted a bean
> > operation on a null object.
> >         at
> > org.apache.jasper.runtime.JspRuntimeLibrary.handleGetProperty(JspRuntimeLibrary.java:427)
> >
> > part of the jsp file:
> > <%
> > nl.step.stepdb.person.interfaces.Person p;
> > p = pbrowse.createUser();
> > %>
> >
> > now I KNOW that the creation of the person is succesfull because it
> > turns up in the datatbase.
> > so what's wrong here?
> >
> > i use jboss-2.0-final with tomcat 3.2b7.
> > i could really use some help here...
> >
> > -Alexander.
>
> In your useBean tag, did you give the complete package when naming the
> class?
> If you just give the class, the bean will not be created.
>
> --
> WBB - wbrogden@bga.com
> Author of Java Developer's Guide to Servlets and JSP
> ISBN 0-7821-2809-2

Hi!,

i didn't use the <jsp:useBean> tag at all, because i made an idGeneratorBean that creates
a
unique id for a person. Right now this means that <jsp:useBean ... /> cannot create
a person
because it doesn't know how to give that person a unique id...

So you are saying that the usebean tag should create the instance of my person bean? and only
after that can i try getProperty and setProperty?

This would mean some re-writing of my beans, so something like below WOULD work?
:::::::::::
add.jsp
:::::::::::
<jsp:useBean id="idgen" class="nl.step.stepdb.idgen.interfaces.IdGenerator" scope="page"/>
<jsp:useBean id="person" class="nl.step.stepdb.person.interfaces.Person" scope="page/>

<% person.setId(idgen.createId("Person")); %>
<jsp:setProperty name="person" property="*"/>

just for arguments sake, why does then usebean tag need to create a bean before i can use
set-
and getProperty on it?

thnx,
-Alexander.


Mime
View raw message