Robert Nicholson wrote:
>
> Are you absolutely sure about the last part?
>
> If you do an expression will it call .toString() on the return value?
It will *not* call toString(); it uses the result as is to set the
property. And yes, I'm sure. It's in the errata for JSP 1.1 because
it was not clearly described in the original specification:
<http://java.sun.com/products/jsp/errata_1_1_a_042800.html>
See specifically issue 7.
Hans
> > -----Original Message-----
> > From: A mailing list about Java Server Pages specification and reference
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Hans Bergsten
> > Sent: Tuesday, September 26, 2000 8:24 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: taglib attribute question
> >
> >
> > Jill Foley wrote:
> > >
> > > I'm reading about tag libs and I have a question about
> > > attributes.
> > >
> > > I read "The attribute value is supplied to the method as a
> > > String". But then I saw an example of a tag handler for the tag
> > >
> > > <tlt:twa attr1="value1">
> > >
> > > that had:
> > >
> > > private AttributeClass attr1;
> > > setAttr1(AttributeClass ac) {...}
> > >
> > > So my question is: can an attribute be any java object? Can I do
> > > this?:
> > >
> > > <mylib:presonHeader param="<%= personBean.getPerson() %>" />
> > >
> > > and have a setParam(Person person) in my tag handler?
> >
> > None of the answers I've seen so far is 100% right, so let me try to
> > clarify what the spec says you can and can not do.
> >
> > If you use a literal string as the attribute value, such as
> >
> > <tlt:twa attr1="value1" />
> >
> > the JSP container looks at the type of the corresponding property in the
> > tag handler class to see if the value needs to be converted. If the
> > property is of type boolean, Boolean, byte, Byte, char, Character, double,
> > Double, int, Integer, float, Float, long or Long, it will try to convert
> > the string value to the correct type for the property. If the property
> > is a String, the value is of course used as is. If it's something else,
> > you get a translation-time error.
> >
> > If you need to use an attribute that is not one of the types listed above,
> > you need to use a request-time attribute value, such as
> >
> > <tlt:twa attr1="<%= personBean.getPerson() %>" />
> >
> > When you use a request-time attribute value, the JSP container does not
> > attempt to do any type conversion. In other words, the type of the
> > expression must match the type of the corresponding tag handler property.
> >
> > Hans
> > --
> > Hans Bergsten [EMAIL PROTECTED]
> > Gefion Software http://www.gefionsoftware.com
> >
> > ==================================================================
> > =========
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> > http://java.sun.com/products/jsp/faq.html
> > http://www.esperanto.org.nz/jsp/jspfaq.html
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets