• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is it possible to inline an array/list as a tag parameter?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I'm using code generation to generate JSP documents and would like to be able to pass selection values to my custom select field tag as follows as opposed to dynamically building a List via scriptlets and passing the list as my "items":

<ui:select name="locked" items='${{"","Please Select"},{"true","Yes"},{"false","No"}}'/>

When I try this, I get the following stack trace. I've tried several varations of this syntax with no luck and was wondering if this is even possible or if I just haven't nailed the correct syntax yet.

As a side note, I'm using JSP 2.0 tag files as opposed to coding my tag library in Java.

Thanks in advance!
Peter


org.apache.jasper.JasperException: /WEB-INF/forms/doctest_en-us.jspx(83,103) "${<<"","Please Select"},{"true","Yes"},{"false","No"}>>" contains invalid expression(s): javax.servlet.jsp.el.ELException: Encountered "{", expected one of [<INTEGER_LITERAL>, <FLOATING_POINT_LITERAL>, <STRING_LITERAL>, "true", "false", "null", "(", "-", "not", "!", "empty", <IDENTIFIER>]

at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:83)

at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:402)

at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:236)

at org.apache.jasper.compiler.JspUtil.validateExpressions(JspUtil.java:640)
.
.
.
 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I assume that the 'ui' tag has been defined in your tag lib file. By looking at the exception, I think that the class (probably you would have defined this class within some other custom tag such as <tagclass> does not recognize a few of the string literals that you have specified in your name attribute of the <ui/> tag.

I am not sure if this is actually the problem in your case, but I remember facing a problem on similar lines with the values that I had provided for the tag's attribute were not being recognized by the corresponding tag class. Just check if this is the case.
 
Vijayendra V Rao
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Vijayendra V Rao:
I assume that the 'ui' tag has been defined in your tag lib file. By looking at the exception, I think that the class (probably you would have defined this class within some other custom tag such as tagclass, does not recognize a few of the string literals that you have specified in your name attribute of the <ui/> tag.



Sorry, the winking eye was a mistake
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, you cannot automatically create lists using any type of EL notation.
[ November 08, 2004: Message edited by: Bear Bibeault ]
 
Peter White
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the replies. It looks like I can do what I want with OGNL so now I need to find a way to replace the default ExpressionEvaluator used in JSP 2.0 with my own that can use OGNL to evaluate the inlined lists.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic