struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Li Ying <liying.cn.2...@gmail.com>
Subject Re: Incorrect test syntax
Date Fri, 24 Sep 2010 14:01:22 GMT
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.Project@dba2">
...

check this page:
http://www.opensymphony.com/ognl/html/LanguageGuide/staticFields.html
to see the syntax to reference [Static Fields] in OGNL.


2010/9/24 Michaƫl JERUSALMI <michaeljeru@hotmail.com>

>
> Dave, you were so right !
>
> It was indeed not a String object that is returned by config.getProject(),
> but the value of an enum of type Project.
> So I made that method returning a String instead, and it's working !
>
> Thank you for your help.
>
> But by curiosity, what does the OGNL espace do? Because, searching on
> forums, i saw many times that syntax, and tried it, but I never knew what it
> was for.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message