You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jarek Skreta <Ja...@nesscomp.com> on 2000/10/06 22:18:27 UTC

JSP and Beans - still no resolution

Hello,

I am trying a simple application where JSP pages use Beans. The JSP in
question uses jsp:UseBean action and then jsp:setProperty to pass some
parameters. When I use the setProperty action with property='*' then the I
am getting an exception when the Bean is called indicating a 'null pointer'.
If I set the properties explicitly (property="name" valu="value") then I am
getting the following exception:

org.apache.jasper.JasperException: Cannot find any information on property
'DbDriver' in a bean of type 'DbBean'

This all happens when I run the application from a browser with Tomcat (3.1)
running. If however, I run it from within the development IDE (JDeveloper)
everything seems to be fine.

Anbody has an idea what to look for?

Thanks,

Jarek Skreta


Re: JSP and Beans - still no resolution

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Christopher Farley wrote:

> On Fri, 6 Oct 2000, Craig R. McClanahan wrote:
>
> > According to the JavaBeans specifications, property names start with a lower
> > case letter, not upper case.
>
> A bit off-topic, but:
>
> Isn't this rule more complicated than that? For example, I recall having a
> getter method called getHTML(), and I tried to access it via
> property="hTML", but in fact it needed to be property="HTML". I hate it
> when the specification is a bit too clever...
>

You're right, the actual rules are slightly more complex -- see the JavaBeans spec
for more details.  If I remember the history right, there was pretty vigorous
feedback on the original JavaBeans spec insisting on that particular bit of
cleverness about multiple capital letters in a row  ...

>
> ----
> Christopher Farley
> Northern Brewer / 1150 Grand Avenue / St. Paul, MN 55105
> www.northernbrewer.com

Craig

====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat



Re: JSP and Beans - still no resolution

Posted by Christopher Farley <ch...@northernbrewer.com>.
On Fri, 6 Oct 2000, Craig R. McClanahan wrote:

> According to the JavaBeans specifications, property names start with a lower
> case letter, not upper case.

A bit off-topic, but:

Isn't this rule more complicated than that? For example, I recall having a
getter method called getHTML(), and I tried to access it via
property="hTML", but in fact it needed to be property="HTML". I hate it
when the specification is a bit too clever...

----
Christopher Farley
Northern Brewer / 1150 Grand Avenue / St. Paul, MN 55105
www.northernbrewer.com


RE: JSP and Beans - still no resolution

Posted by Jarek Skreta <Ja...@nesscomp.com>.
Craig,

A big thank you. It worked.

However, possibly there was some problem with Tomcat 3.1. Just before I got
your reply I switched to Tomcat 3.2b and the other JSP page (the one with
property='*') started working without any changes.

Regds,

Jarek


-----Original Message-----
From: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
Sent: 06 October 2000 21:28
To: tomcat-user@jakarta.apache.org
Subject: Re: JSP and Beans - still no resolution


Jarek Skreta wrote:

> Hello,
>
> I am trying a simple application where JSP pages use Beans. The JSP in
> question uses jsp:UseBean action and then jsp:setProperty to pass some
> parameters. When I use the setProperty action with property='*' then the I
> am getting an exception when the Bean is called indicating a 'null
pointer'.
> If I set the properties explicitly (property="name" valu="value") then I
am
> getting the following exception:
>
> org.apache.jasper.JasperException: Cannot find any information on property
> 'DbDriver' in a bean of type 'DbBean'
>

According to the JavaBeans specifications, property names start with a lower
case letter, not upper case.

Thus, in your bean you would have

    public String getDbDriver() ...
    public void setDbDriver(String newDbDriver) ...

but in your JSP page you would use

    <jsp:setProperty name="beanname" property="dbDriver" value="xyz"/>

>
> This all happens when I run the application from a browser with Tomcat
(3.1)
> running. If however, I run it from within the development IDE (JDeveloper)
> everything seems to be fine.
>
> Anbody has an idea what to look for?
>
> Thanks,
>
> Jarek Skreta

Craig McClanahan

====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat



Re: JSP and Beans - still no resolution

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Jarek Skreta wrote:

> Hello,
>
> I am trying a simple application where JSP pages use Beans. The JSP in
> question uses jsp:UseBean action and then jsp:setProperty to pass some
> parameters. When I use the setProperty action with property='*' then the I
> am getting an exception when the Bean is called indicating a 'null pointer'.
> If I set the properties explicitly (property="name" valu="value") then I am
> getting the following exception:
>
> org.apache.jasper.JasperException: Cannot find any information on property
> 'DbDriver' in a bean of type 'DbBean'
>

According to the JavaBeans specifications, property names start with a lower
case letter, not upper case.

Thus, in your bean you would have

    public String getDbDriver() ...
    public void setDbDriver(String newDbDriver) ...

but in your JSP page you would use

    <jsp:setProperty name="beanname" property="dbDriver" value="xyz"/>

>
> This all happens when I run the application from a browser with Tomcat (3.1)
> running. If however, I run it from within the development IDE (JDeveloper)
> everything seems to be fine.
>
> Anbody has an idea what to look for?
>
> Thanks,
>
> Jarek Skreta

Craig McClanahan

====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat