David M. Karr wrote: > Is it possible to have a custom tag have an attribute that gets > mapped to a getter/setter pair which doesn't match the attribute's > name wrt the JavaBeans specification? > > For instance, normally an attribute named "dispatch" would get mapped > to "getDispatch()" and "setDispatch()". However, I need to have it > map to "getDispatchExpr()" and "setDispatchExpr()". > > I need this because my tag is deriving from a base class tag which > uses the same attribute, but which is mapped to a getter/setter pair > which returns/expects a boolean, instead of a string. My derived > class needs to use a string, not a boolean. This is why I've defined > "getDispatchExpr()" and "setDispatchExpr()". > > I was under the impression that this is what a "BeanInfo" class is > for. It appears, however, the use of this class is just a > convention, for IDEs which follow the JavaBeans specification, and > that normal JavaBeans introspection doesn't use them. In my test > case, my BeanInfo class appears to be ignored.
BeanInfo classes are used by the JavaBeans introspector so it should work. You may some ideas from the "PropertyEditors for custom string literal conversion" section in this article I wrote for ONJava.com: <http://www.onjava.com/pub/a/onjava/2001/11/07/jsp12.html> It deals with using a BeanInfo class to associate PropertyEditors with a custom action attribute, but the basics are the same. Hans -- Hans Bergsten [EMAIL PROTECTED] Gefion Software http://www.gefionsoftware.com JavaServer Pages 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://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com