You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Kumar, Sandy" <SK...@npc.net> on 2005/12/21 15:56:40 UTC

logic:notEqual

All,
 
I am trying to compare a variable with a value set in request attribute.
But <logic:notEqual> tag does not accept variable in the "value"
attribute. It has to be a constant.
Does anyone know any alternative?.
 
Here is my code.
<logic:iterate id="element" name="WebidViewBean" property="iterator"

indexId="i">

<tr>

<td><html-el:select name="dynaHierarchySelectionForm" multiple="true"

size="4" property='level${i+1}' >

<html:option value="All" >Select All</html:option>

<html:options collection="element" property="webId"

labelProperty="webIdDescription" />

</html-el:select></td>

<td>

<logic:notEqual value="${i+2}" name="levelDepth" scope="request"> 

<html-el:submit property="submit" value="Select Level ${i+2}" />

</logic:notEqual>

</td>

</tr>

</logic:iterate>

Thanks,
Sandy Kumar

Re: logic:notEqual

Posted by Laurie Harper <la...@holoweb.net>.
Kumar, Sandy wrote:
> All,
>  
> I am trying to compare a variable with a value set in request attribute.
> But <logic:notEqual> tag does not accept variable in the "value"
> attribute. It has to be a constant.
> Does anyone know any alternative?.
>  
> Here is my code.
> <logic:iterate id="element" name="WebidViewBean" property="iterator"
> 
> indexId="i">
> 
> <tr>
> 
> <td><html-el:select name="dynaHierarchySelectionForm" multiple="true"
> 
> size="4" property='level${i+1}' >
> 
> <html:option value="All" >Select All</html:option>
> 
> <html:options collection="element" property="webId"
> 
> labelProperty="webIdDescription" />
> 
> </html-el:select></td>
> 
> <td>
> 
> <logic:notEqual value="${i+2}" name="levelDepth" scope="request"> 
> 
> <html-el:submit property="submit" value="Select Level ${i+2}" />
> 
> </logic:notEqual>
> 
> </td>
> 
> </tr>
> 
> </logic:iterate>
> 
> Thanks,
> Sandy Kumar
> 

Since you're already using JSTL, you should prefer it's tags over 
Struts' tags where possible. Try replacing your logic:notEqual with the 
following:

   <c:if test="${levelDepth != i+2}">

L.


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