You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mujahid Ali <ma...@leftbrain.com> on 2006/03/16 21:00:13 UTC

[OT] PropertyEditor

I have a custom tag in which I am evaluating an attribute as follow:

(Locale)ExpressionEvaluatorManager.evaluate("locale", expr, 
Locale.class, this, pageContext)

But I get an error:

javax.servlet.jsp.JspException: An error occurred while evaluating 
custom action attribute "locale" with value "en_US": Attempt to convert 
String "en_US" to type "java.util.Locale", but there is no 
PropertyEditor for that type (null)
    at org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Unknown 
Source)
    at org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Unknown 
Source)
    at 
org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.evaluate(Unknown 
Source)


I am using standard.jar (v 1.1).

If I want to convert a String to Locale object, I assume I need to 
define some sort of PropertyEditor??

Any help is appreciated.

Thanks,

Mujahid

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] PropertyEditor

Posted by Mujahid Ali <ma...@leftbrain.com>.
Yep thats what I ended up doing. The code

	(Locale)ExpressionEvaluatorManager.evaluate("locale", expr,Locale.class, this, pageContext)

was working against standard.jar (1.0).So just not sure why this is breaking all of a sudden.

Thanks,

Mujahid

Frank W. Zammetti wrote:

>I'm not sure about the convertor, but could you instead just do:
>
>String localCode = (String)ExpressionEvaluatorManager.evaluate("locale",
>expr, String.class, this, pageContext);
>Locale locale = new Locale(localCode);
>
>At least that way your only asking the ExpressionEvaluatorManager to deal
>with a basic type that by default it knows how to handle.  I know, it's
>not one concise line then :)
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] PropertyEditor

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
I'm not sure about the convertor, but could you instead just do:

String localCode = (String)ExpressionEvaluatorManager.evaluate("locale",
expr, String.class, this, pageContext);
Locale locale = new Locale(localCode);

At least that way your only asking the ExpressionEvaluatorManager to deal
with a basic type that by default it knows how to handle.  I know, it's
not one concise line then :)

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: fzammetti@hotmail.com
Java Web Parts -
http://javawebparts.sourceforge.net
Supplying the wheel, so you don't have to reinvent it!

On Thu, March 16, 2006 3:00 pm, Mujahid Ali said:
> I have a custom tag in which I am evaluating an attribute as follow:
>
> (Locale)ExpressionEvaluatorManager.evaluate("locale", expr,
> Locale.class, this, pageContext)
>
> But I get an error:
>
> javax.servlet.jsp.JspException: An error occurred while evaluating
> custom action attribute "locale" with value "en_US": Attempt to convert
> String "en_US" to type "java.util.Locale", but there is no
> PropertyEditor for that type (null)
>     at org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Unknown
> Source)
>     at org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Unknown
> Source)
>     at
> org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.evaluate(Unknown
> Source)
>
>
> I am using standard.jar (v 1.1).
>
> If I want to convert a String to Locale object, I assume I need to
> define some sort of PropertyEditor??
>
> Any help is appreciated.
>
> Thanks,
>
> Mujahid
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org