struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michaël JERUSALMI <michaelj...@hotmail.com>
Subject RE: Incorrect test syntax
Date Fri, 24 Sep 2010 13:45:53 GMT

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.

> Date: Fri, 24 Sep 2010 09:39:38 -0400
> Subject: Re: Incorrect test syntax
> From: davelnewton@gmail.com
> To: user@struts.apache.org
> 
> First I'd try wrapping the expression in the OGNL escape:
> 
> "%{config.project == 'dba2'}"
> 
> Then I'd try checking the type (class) of "config.project" and see if it's
> really a string.
> 
> Dave
> 
> On Fri, Sep 24, 2010 at 9:36 AM, Michaël JERUSALMI
> <michaeljeru@hotmail.com>wrote:
> 
> >
> > Sorry, it didn't change a thing. It still goes by the else...
> >
> > > Date: Fri, 24 Sep 2010 22:32:04 +0900
> > > Subject: Re: Incorrect test syntax
> > > From: liying.cn.2010@gmail.com
> > > To: user@struts.apache.org
> > >
> > > Hi Michael:
> > >
> > > Maybe you can not check if a String has same content with another by the
> > > operator [==]. Try the method [String.equals()] instead.
> > >
> > > In your case, i think i should be:
> > >
> > > ....
> > > <s:if test="config.project.eqauls('dba2')">
> > > ....
> > >
> > >
> > > 2010/9/24 Michaël JERUSALMI <michaeljeru@hotmail.com>
> > >
> > > >
> > > > Hi,
> > > > I'm working on a web application with Struts, made for several
> > projects,
> > > > and I'm trying to write a test to display (or not) a tab in case of a
> > > > particular project.
> > > >
> > > > I wrote a test, which positive result should be to add a new tab, and
> > which
> > > > negative result is to write the content of the ProjectName property.
> > > >
> > > > Here it is :
> > > >
> > > >    <s:if test="config.project == 'dba2'">
> > > >           <li><a href="#null" onclick="openReport('ia08');">Unsolved
> > > > Tickets</a></li>
> > > >    </s:if>
> > > >    <s:else>
> > > >           <s:property value="config.project" /> //config.project
> > contains
> > > > the value "dba2"
> > > >    </s:else>
> > > >
> > > > The result so far as always been to write the content of the value
> > > > config.project, ie dba2 instead of writing the expected tab.
> > > >
> > > > I've tried several syntax, including test="%{"config.project} ==
> > 'dba2'",
> > > > but nothing worked.
> > > >
> > > > Hoping you could help me.
> > > >
> > > > Michael
> > > >
> >
> >
 		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message