I will give that a try.  I am sure it will work.  Thank you so much for
your clear and detailed response.  I now not only know what to do, but
more importantly why it needs to be done that way. Thank you!

 

-----Original Message-----
From: Jeromy Evans [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 30, 2007 10:10 AM
To: Struts Users Mailing List
Subject: Re: [s2] If Test Conditions

The problem is that displaytag places the current row in the pageContext
but none of your expressions are addressing it.

I tend to just use JSTL within displaytag tables as its much easier to
access the current row.
I also tend to add getters to my bean to simplify the expressions
instead of hardcoding it in the JSP. eg. isNew()

Anyway, this is a struts2 way to access it:

<display:table id="idContract" name="contracts" class="results">
   <s:set name="rowIdContact" value="#attr.idContract"/>
      <display:column titleKey="label.select">
        <s:if test="#rowIdContact.equals('NEW')">
                <s:checkbox name="selectedContracts"

etc. 
The main point of that is that the idContact row is accessed via #attr

But this is my preferred way:

<display:table id="idContract" name="contracts" class="results">
   <display:column titleKey="label.select">
      <c:if test="idContract.new">
        <s:checkbox name="selectedContracts"

where isNew() is property of the row class.

Hoying, Ken wrote:
> I am having a devil of a time getting a simple if test condition to 
> work properly.
>
> Here is the jist of what I am trying to do:
>
> <display:table id="idContract" name="contracts" class="results">
>       <display:column         titleKey="label.select">
>               <s:if test="${idContract.status}=='NEW'">
>                       <s:checkbox name="selectedContracts"
> fieldValue="${idContract.id}"/>
>               </s:if>
>               <s:else>
>                       &nbsp;${idContract.status}&nbsp;
>               </s:else>
>       </display:column>
>       <display:column         property="number"
> titleKey="label.contractNumber" />
>       <display:column         property="status"
> titleKey="label.contractStatus" />
>       <display:column         property="numAuthFacilities"
> titleKey="label.authFacilities" />
> </display:table>
>
> I have tried the following and do not seem to be able to get any of 
> them to work:
> "${idContract.status}=='NEW'"
> '${idContract.status}=="NEW"'
> "%{idContract.status}=='NEW'"
> "${idContract.status=='NEW'}"
> "%{idContract.status=='NEW'}"
> "idContract.status=='NEW'"
> "#idContract.status=='NEW'"
>
> And a host of others that I cannot recall.
>
> Does anyone happen to know the correct syntax?  I am getting tired of 
> guessing and cannot seem to make rhyme or reason out of the syntax 
> rules
> :-)
>
> Thanks in advance!
>
> -----------------------------------------
> ***Note:The information contained in this message may be privileged 
> and confidential and protected from disclosure. If the reader of this 
> message is not the intended recipient, or an employee or agent 
> responsible for delivering this message to the intended recipient, you

> are hereby notified that any dissemination, distribution or copying of

> this communication is strictly prohibited. If you have received this 
> communication in error, please notify the Sender immediately by 
> replying to the message and deleting it from your computer. Thank you.

> Premier Inc.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to