I am writing a custom tag where one of the attributes required is a String
array. I know I'm being awkward but I want to be able to create this string
array within the custom tag line. I imagined that I would be able to do
something like the following
<prefix:mytag myattribute="<%= new String[] {item1, item2, item3} %>" />
However, tomcat wants to translate the type into something.class, but gets
muddled up because of the [].
I then thought I could change the String array into a String of comma
separated items, and allow the custom tag to convert this into a string
array using a StringTokenizer. However, the problem here is that each of the
items in the list is an expression. I had imagined that if I did something
like the following
<prefix:mytag myattribute="<%= item1 %>, <%= item2 %>, <%= item3 %>" />
that each expression would be evaluated. But it doesn't. It recognises the
first <%= and the last %> and tries to evaluate everything in between as one
expression.
If I change it to
<prefix:mytag myattribute="<%= item1, item2, item3 %>" />
the expressions don't get evaluated and it doesn't consider it as one quoted
string anyway.
Can anyone suggest how to get either of these 2 approaches to work, or
suggest a different approach to set a custom tag attribute that is a list of
expressions?
Thanks,
Catharine
===========================================================================
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