Hi Michael:

Or you can use another simple solution:

Convert the value to String(by invoke the [toString] method),
before you can compare it to the String constant.

In your case, it should be:

<s:if test="config.project.toString() == 'dba2'">
...



2010/9/24 Li Ying <liying.cn.2...@gmail.com>

> Hi Michael:
>
> I think changing the return type from Enum to String is not a very good
> solution.
> It maybe make your JSP get work,but your Java code will become a little
> ugly.
>
> I think the better way is:
> (1)do not chang the return type of config.getProject().
> (2)in tag <s:if>, compare it to an enum constant, rather than a string
> constant.
>
> in your case, it should be:
>
> ...
> <s:if test="project == @yourfullpackagename.proj...@dba2">
> ...
>
> check this page:
> http://www.opensymphony.com/ognl/html/LanguageGuide/staticFields.html
> to see the syntax to reference [Static Fields] in OGNL.
>
>
>

Reply via email to