• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Simple tag handler using array of int

 
Luis Centeno
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all...

I am going through simple tag handlers. I created a tag handler whose items attribute accepts rtexprvalue:


...and using this tag as

I am getting "Syntax error on token "[", delete this token" and noticed that in generated class is below line:

I know that translation is container-specific but I am not sure if translation was correctly performed by my container (Tomcat 5.5.9), I mean casting to "[I" class does not seem to be correct since "[I" is not a valid identifier for a java class. Any ideas about this behavior?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Luis,

I am getting "Syntax error on token "[", delete this token" and noticed that in generated class is below line:

The value of the jsp:attribute has to be a String.

The following should work:


Regards,
Frits
 
Luis Centeno
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Frits,


The value of the jsp:attribute has to be a String.

So this means that not always I use attributes in a custom tag, I can use <jsp:attribute>? I thought attributes and <jsp:attribute> was equivalent...Based on what you said, <jsp:attribute> must only be used when setItems(String) method exist in custom tag handler, right?


The following should work:
<rnd:showInTable items="${randomInts}"></rnd:showInTable>

I changed and it worked properly....

Thanks
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Luis,

I thought attributes and <jsp:attribute> was equivalent...Based on what you said, <jsp:attribute> must only be used when setItems(String) method exist in custom tag handler, right?


Not exactly, it can be a String or something that can be converted into a String, have a look at this part of the jsp2.0 specs:
JSP.5.10 <jsp:attribute>
For standard or custom action attributes that accept a request-time expression
value, the Container must evaluate the body of the <jsp:attribute> action and
use the result of this evaluation as the value of the attribute. The body of the
attribute action can be any JSP content in this case. If the type of the attribute
is not String, the standard type conversion rules are applied, as per
Section JSP.1.14.2.1, "Conversions from String values".


Regards,
Frits
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic