I got the following exception while trying to integrate a custom action with JSTL EL.
SEVERE: Servlet.service() for servlet jsp threw exception javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "map" with value "org.apache.commons.el.ImplicitObjects$5@1b34126": Attempt to convert String "org.apache.commons.el.ImplicitObjects$5@1b34126" to type "java.util.Map", but there is no PropertyEditor for that type (null) at org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:109) at org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:129) at org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.evaluate(ExpressionEvaluatorManager.java:75) at code.tag.ShowMapAction.doStartTag(ShowMapAction.java:24)
The error shown is at ShowMapAction class at map = (Map) ExpressionEvaluatorManager.evaluate("map", mapName,Map.class, this, pageContext);
I have defined the tld file as well. Can anyone help me to sought this out?
It seems that you are trying to set a Map property, using a String. I'm just guessing but are trying to do something like : <mytag:mmyaction map="mymap" .../> instead of <mytag:mmyaction map="${mymap}" .../>
Please show us how you are trying to use your custom action.
I don't think you should be using ExpressionEvaluatorManager.
Vanchi Nathan
Ranch Hand
Joined: Feb 24, 2004
Posts: 107
posted
0
hi,
thanks your code did work...
Please brief, why shouldn't we use the ExpressionEvaluationManager class as the code i used was from a text book.
regards
vanchi
Michael Ku
Ranch Hand
Joined: Apr 20, 2002
Posts: 510
posted
0
Which book used ExpressionEvaluationManager?
Vanchi Nathan
Ranch Hand
Joined: Feb 24, 2004
Posts: 107
posted
0
hi Michael,
The code is found in the book : 'Core JSTL Mastering the JSP Standard Tag Library" on page 94.
Stefan Evans
Bartender
Joined: Jul 06, 2005
Posts: 1002
posted
0
That book focuses on JSTL1.0.
One of the major changes between JSTL1.0 and JSTL1.1 was the responsibility for evaluation of EL expressions. In JSP1.2, the container knew nothing about ${expr} and thus the tags had to evalute the expression itself (using the ExpressionEvaluatorManager) In JSP2.0 the container understands and evaluates the EL expression (provided that you have configured your web.xml appropriately)
The tag code you have got there is written in JSTL1.0 style - ie the attribute it takes is a String that is expected to be an EL expression to evaluate. Presumably you have a JSP2.0 container which is configured to evaluate the expressions already - so it has already evaluated the expression to be a Map.
Bottom line - if you have a JSP2.0 container and it is configured to evaluate EL itself, then your tag classes should never use the ExpressionEvaluatorManager.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.