Originally posted by karthik Guru:
[QB]I was wondering if a custom tag c'd accept a Enumeration object and run through it displaying the contents on the browser?
Yes,
JSP supports the idea of an
rtexprvalue (request-time expression value). Rtexprvalues use the familiar <%= ... %> syntax inside the attribute value. For instance:
To let your tag accept rtexprvalues, you can add a sub-element that looks like
to any of your tag's <attribute> elements in its tag-library descriptor (TLD) file.
Note that rtexprvalue, and other uses of <% ... %> in general, depend on using
Java code inside your JSP pages, which is generally regarded as a practice that leads to poor maintainability. To avoid Java code and rtexprvalues, you can use JSTL, the new JSP Standard Tag Library. JSTL lets you pass data between tags using an expression language, so you can say
instead of
For more information on JSTL, see
http://java.sun.com/products/jsp/jstl I'm happy to answer any JSTL question you have; I'm its reference-implementation lead and have written an upcoming book that explains all of JSTL's details. Hope that helps!