You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Arshak Navruzyan <ar...@netcomputing.com> on 1999/12/19 02:30:24 UTC
setProperty error
Hello,
I am receiving this error:
javax.servlet.ServletException: Can't find method for Criticality
When I do this:
<jsp:setProperty name="rrs" property="Criticality" value="5"/>
yet getProperty works fine:
<jsp:getProperty name="rrs" property="Criticality"/>
the bean does have a setCriticality method:
public void setCriticality(int value) {
Criticality = value;
}
Thank you,
Arshak Navruzyan
NetComputing
515 S. Figueroa St Ste 1060
Los Angeles, CA 90071
213.689.1060 x12
213.689.1062 fax
Re: setProperty error [bug]
Posted by Danno Ferrin <sh...@earthlink.net>.
Actually this underscores a bug that exists in the current tomcat
version: getProperty is not properly decoding property names, this is not
the only instance either... in examples/jsp/date.jsp dSTOffset is improperly
used as the bean property name when the classes in java.beans.* will
introspect it to a property named "DSTOffset".
When it comes to default introspection the beans spec says to lowercase
the first character after the get/set unless the second character is also
upper case. Of course this is assuming that a beanInfo doesn't do some
custom property/method mappings of their own. I've known about this one for
a while I just haven't bothered to find and decipher the code in getProperty
that is responsible for this.
--Danno
----- Original Message -----
From: "Doug Collinge" <dc...@abyssnet.com>
To: <ge...@jakarta.apache.org>
Sent: Saturday, December 18, 1999 11:15 PM
Subject: Re: setProperty error
> If the method name is "setCriticality" then the property names is
> "criticality" - this is the spec, though it seems to be confusing a lot
> of people.
>
> Arshak Navruzyan wrote:
>
> > Hello,
> >
> > I am receiving this error:
> >
> > javax.servlet.ServletException: Can't find method for Criticality
> >
> > When I do this:
> >
> > <jsp:setProperty name="rrs" property="Criticality" value="5"/>
> >
> > yet getProperty works fine:
> >
> > <jsp:getProperty name="rrs" property="Criticality"/>
> >
> > the bean does have a setCriticality method:
> >
> > public void setCriticality(int value) {
> > Criticality = value;
> > }
> >
> > Thank you,
> >
> > Arshak Navruzyan
> > NetComputing
> > 515 S. Figueroa St Ste 1060
> > Los Angeles, CA 90071
> > 213.689.1060 x12
> > 213.689.1062 fax
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: general-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org
>
>
Re: setProperty error
Posted by Doug Collinge <dc...@abyssnet.com>.
If the method name is "setCriticality" then the property names is
"criticality" - this is the spec, though it seems to be confusing a lot
of people.
Arshak Navruzyan wrote:
> Hello,
>
> I am receiving this error:
>
> javax.servlet.ServletException: Can't find method for Criticality
>
> When I do this:
>
> <jsp:setProperty name="rrs" property="Criticality" value="5"/>
>
> yet getProperty works fine:
>
> <jsp:getProperty name="rrs" property="Criticality"/>
>
> the bean does have a setCriticality method:
>
> public void setCriticality(int value) {
> Criticality = value;
> }
>
> Thank you,
>
> Arshak Navruzyan
> NetComputing
> 515 S. Figueroa St Ste 1060
> Los Angeles, CA 90071
> 213.689.1060 x12
> 213.689.1062 fax
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org
Re: setProperty error and other specification vaugeness
Posted by Hans Bergsten <ha...@gefionsoftware.com>.
Danno Ferrin wrote:
>
> The whole interpretation of what that parentetical comment should definatly
> be ironed out in a rev of the JSP spec. By The way, the final version of
> the 1.1 spec is out, so pr2 is dated (although not too far off of what is in
> the final). In light of 2.1.1 saying there are three element types it seems
> to exclude those as well. But if any element can provide the bean for
> setting then the comment should be altered or changed.
>
> While we are on the subject of the specification can table 2-4 in the same
> setProperty section PLEASE be changed. java.lang.Character.valueOf(String)
> does not exist! I have sent comments to the address on the spec but it has
> never changed. What will it take to get this changed to something that is
> possible in Java?
I have forwarded this discussion to the JSP spec working group and
asked for a clarification and correction.
Hans
--
Hans Bergsten hans@gefionsoftware.com
Gefion Software http://www.gefionsoftware.com
Re: setProperty error and other specification vaugeness
Posted by Danno Ferrin <sh...@earthlink.net>.
The whole interpretation of what that parentetical comment should definatly
be ironed out in a rev of the JSP spec. By The way, the final version of
the 1.1 spec is out, so pr2 is dated (although not too far off of what is in
the final). In light of 2.1.1 saying there are three element types it seems
to exclude those as well. But if any element can provide the bean for
setting then the comment should be altered or changed.
While we are on the subject of the specification can table 2-4 in the same
setProperty section PLEASE be changed. java.lang.Character.valueOf(String)
does not exist! I have sent comments to the address on the spec but it has
never changed. What will it take to get this changed to something that is
possible in Java?
--Danno
----- Original Message -----
> Hans Bergsten wrote:
>
> > Danno Ferrin wrote:
> > >
> > > Read the spec, specifically sections 2.13.2.1 and 2.13.3. It is
behaving
> > > properly according to the way the behaviors are speced, even though it
may
> > > feel inconsistant and constrictive.
> >
> > The spec is a bit vague IMHO. The name attribute for setProperty is
defined as
> > "The name of a Bean instance defined by a <jsp:useBean> element or some
other
> > element." The last part, "some other element" to me means it can be an
object
> > added to one of the scopes by a custom action, scriptlet code, or a
servlet,
> > not only by a useBean action.
> >
>
> I agree that it is a little vague. However, support for your
interpretation can be
> found in Section 2.1.1 of the JSP 1.1pr2, which defines the existence of
three types
> of JSP elements: directive elements, scripting elements, and action
elements. By
> that definition, it would seem that scriptlets are indeed an element.
>
> The question them becomes, what does a scriptlet need to do to define a
new bean? It
> seems to me that declaring a local variable is not sufficient -- but if it
stores the
> bean in the appropriate scope (with PageContext.setAttribute()), then the
bean should
> be considered a valid target for <jsp:setProperty> type calls. After all,
that is
> what a custom action is required to do if it wants to define a new
scripting
> variable.
>
> > Hans
>
> Craig McClanahan
Re: setProperty error
Posted by "Craig R. McClanahan" <cm...@mytownnet.com>.
Hans Bergsten wrote:
> Danno Ferrin wrote:
> >
> > Read the spec, specifically sections 2.13.2.1 and 2.13.3. It is behaving
> > properly according to the way the behaviors are speced, even though it may
> > feel inconsistant and constrictive.
>
> The spec is a bit vague IMHO. The name attribute for setProperty is defined as
> "The name of a Bean instance defined by a <jsp:useBean> element or some other
> element." The last part, "some other element" to me means it can be an object
> added to one of the scopes by a custom action, scriptlet code, or a servlet,
> not only by a useBean action.
>
I agree that it is a little vague. However, support for your interpretation can be
found in Section 2.1.1 of the JSP 1.1pr2, which defines the existence of three types
of JSP elements: directive elements, scripting elements, and action elements. By
that definition, it would seem that scriptlets are indeed an element.
The question them becomes, what does a scriptlet need to do to define a new bean? It
seems to me that declaring a local variable is not sufficient -- but if it stores the
bean in the appropriate scope (with PageContext.setAttribute()), then the bean should
be considered a valid target for <jsp:setProperty> type calls. After all, that is
what a custom action is required to do if it wants to define a new scripting
variable.
> Hans
Craig McClanahan
Re: setProperty error
Posted by Hans Bergsten <ha...@gefionsoftware.com>.
Danno Ferrin wrote:
>
> Read the spec, specifically sections 2.13.2.1 and 2.13.3. It is behaving
> properly according to the way the behaviors are speced, even though it may
> feel inconsistant and constrictive.
The spec is a bit vague IMHO. The name attribute for setProperty is defined as
"The name of a Bean instance defined by a <jsp:useBean> element or some other
element." The last part, "some other element" to me means it can be an object
added to one of the scopes by a custom action, scriptlet code, or a servlet,
not only by a useBean action.
The second sentence in the definition says "The defining element (in JSP 1.1
only a <jsp:useBean> element) must appear before the <jsp:setProperty> element
in the same file." I guess this is what you mean. My interpretation is that
the useBean action is the only standard JSP action that can be used to define
the bean, but all the other methods (not relying on standard actions) should
work as well (based on the first sentence). This was also the interpretation
by Eduardo (JSP spec responsible) some time back when I asked for a clarification.
And, yes, I did commit a patch that should make both getProperty and setProperty
work no matter how the bean got saved in a scope.
Hans
--
Hans Bergsten hans@gefionsoftware.com
Gefion Software http://www.gefionsoftware.com
Re: setProperty error
Posted by Danno Ferrin <sh...@earthlink.net>.
Read the spec, specifically sections 2.13.2.1 and 2.13.3. It is behaving
properly according to the way the behaviors are speced, even though it may
feel inconsistant and constrictive.
--Danno
----- Original Message -----
From: "Mandar Raje" <ma...@pathfinder.eng.sun.com>
>
> I think the for both set/getProperty it should not
> matter whether the bean is instantiated using a
> useBean or some other mechanism. I think sometime
> back Hans committed some fixes to Tomcat which
> handle this case.
>
> Which version of Tomcat are you using? (Tomcat 3.0?)
>
> Thanks,
> Mandar.
>
> Danno Ferrin wrote:
>
> > <jsp:setProperty ... > only works with a bean instantiated via the
> > <jsp:useBean ...> tag that occurs on the same page, while a
<jsp:getProperty
> > ... > works with any old scripting variable stored in one of the
attribute
> > contexts (page, request, session, or applications). It may seem
> > inconsistant but that is the way it is speced. It also allows for some
> > custom security checking in vendor-supplied servlet engines as well when
it
> > comes to "write access" to beans that may exist in the system level.
> >
> > --Danno
> >
> > ----- Original Message -----
> > From: "Arshak Navruzyan" <ar...@netcomputing.com>
> > To: <ge...@jakarta.apache.org>
> > Sent: Saturday, December 18, 1999 6:30 PM
> > Subject: setProperty error
> >
> > > Hello,
> > >
> > > I am receiving this error:
> > >
> > > javax.servlet.ServletException: Can't find method for Criticality
> > >
> > > When I do this:
> > >
> > > <jsp:setProperty name="rrs" property="Criticality" value="5"/>
> > >
> > > yet getProperty works fine:
> > >
> > > <jsp:getProperty name="rrs" property="Criticality"/>
> > >
> > > the bean does have a setCriticality method:
> > >
> > > public void setCriticality(int value) {
> > > Criticality = value;
> > > }
> > >
> > >
> > > Thank you,
> > >
> > > Arshak Navruzyan
> > > NetComputing
> > > 515 S. Figueroa St Ste 1060
> > > Los Angeles, CA 90071
> > > 213.689.1060 x12
> > > 213.689.1062 fax
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: general-help@jakarta.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: general-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org
>
>
Re: setProperty error
Posted by Mandar Raje <ma...@pathfinder.eng.sun.com>.
I think the for both set/getProperty it should not
matter whether the bean is instantiated using a
useBean or some other mechanism. I think sometime
back Hans committed some fixes to Tomcat which
handle this case.
Which version of Tomcat are you using? (Tomcat 3.0?)
Thanks,
Mandar.
Danno Ferrin wrote:
> <jsp:setProperty ... > only works with a bean instantiated via the
> <jsp:useBean ...> tag that occurs on the same page, while a <jsp:getProperty
> ... > works with any old scripting variable stored in one of the attribute
> contexts (page, request, session, or applications). It may seem
> inconsistant but that is the way it is speced. It also allows for some
> custom security checking in vendor-supplied servlet engines as well when it
> comes to "write access" to beans that may exist in the system level.
>
> --Danno
>
> ----- Original Message -----
> From: "Arshak Navruzyan" <ar...@netcomputing.com>
> To: <ge...@jakarta.apache.org>
> Sent: Saturday, December 18, 1999 6:30 PM
> Subject: setProperty error
>
> > Hello,
> >
> > I am receiving this error:
> >
> > javax.servlet.ServletException: Can't find method for Criticality
> >
> > When I do this:
> >
> > <jsp:setProperty name="rrs" property="Criticality" value="5"/>
> >
> > yet getProperty works fine:
> >
> > <jsp:getProperty name="rrs" property="Criticality"/>
> >
> > the bean does have a setCriticality method:
> >
> > public void setCriticality(int value) {
> > Criticality = value;
> > }
> >
> >
> > Thank you,
> >
> > Arshak Navruzyan
> > NetComputing
> > 515 S. Figueroa St Ste 1060
> > Los Angeles, CA 90071
> > 213.689.1060 x12
> > 213.689.1062 fax
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: general-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org
Re: setProperty error
Posted by Danno Ferrin <sh...@earthlink.net>.
<jsp:setProperty ... > only works with a bean instantiated via the
<jsp:useBean ...> tag that occurs on the same page, while a <jsp:getProperty
... > works with any old scripting variable stored in one of the attribute
contexts (page, request, session, or applications). It may seem
inconsistant but that is the way it is speced. It also allows for some
custom security checking in vendor-supplied servlet engines as well when it
comes to "write access" to beans that may exist in the system level.
--Danno
----- Original Message -----
From: "Arshak Navruzyan" <ar...@netcomputing.com>
To: <ge...@jakarta.apache.org>
Sent: Saturday, December 18, 1999 6:30 PM
Subject: setProperty error
> Hello,
>
> I am receiving this error:
>
> javax.servlet.ServletException: Can't find method for Criticality
>
> When I do this:
>
> <jsp:setProperty name="rrs" property="Criticality" value="5"/>
>
> yet getProperty works fine:
>
> <jsp:getProperty name="rrs" property="Criticality"/>
>
> the bean does have a setCriticality method:
>
> public void setCriticality(int value) {
> Criticality = value;
> }
>
>
> Thank you,
>
> Arshak Navruzyan
> NetComputing
> 515 S. Figueroa St Ste 1060
> Los Angeles, CA 90071
> 213.689.1060 x12
> 213.689.1062 fax
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org
>
>