Dean wrote:
>
> Hello,
>
> The spec seems to say that <jsp:setProperty /> will try to set any property
> (in addition to the types in table 4.1) from a string in the value attribute
> or request parameter if a PropertyEditor with a setAsText() method can be
> found for that type. I've tested a bean and property editor and they work ok
> when building an applet with an IDE, but I get a NullPointerException when I
> try to use them in a JSP page in JRun.
You refer to the draft of the JSP 1.2 specification. The currently
released specification is JSP 1,1. and I'm pretty sure that's the
version JRun supports. With JSP 1.1, the container doesn't look for a
PropertyEditor; it only converts String attribute values to the type
of the property as described in table 4.1 in the spec. If the property
is of some other type, e.g. Color, you need to use a request-time
attribute value expression to set the value, e.g.
<foo:myTag colorValue-"<%= aColorVariable %>" />
or convert the String to the type you need in your your tag handler
class, e.g.
<foo:myTag rgbValue="FFFFFF" />
and something like this in the tag handler
public class MyTag ... {
public void setRgbValue(String rgbValue) {
// Convert the String to a color
...
}
> 1) should the setProperty tag work for any custom type that can be
> represented as a string and has an editor?
For JSP 1.2, yes. For JSP 1.1, see above.
> 2) does each vendor implement their own version of the useBean and other
> standard library tags?
Typically, unless they use the JSP container from the reference
implementation (Apache Tomcat).
Hans
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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