You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Hardik Shah <ha...@yahoo.com> on 2008/10/07 13:49:16 UTC

hw to use if tag

hi

i have vector of vector and i can easily iterate using  <s:iterate> in
between <s:iterate>

but the problem is that some of the element in vector of vector is null

like
------------------------------------
<s:iterator value="attributelist" id="attriblist">
        <tr>
        	 <td><s:property value="attrName"/></td>
            <td><s:property value="attrValue"/></td>
            <td><s:property value="attrType"/></td>
            <td><s:property value="attrForIndiName"/></td>
            <td><s:property value="userTypeName"/></td>
            <td><s:property value="userInput"/></td>
            <td><s:property value="remark"/></td>
            <td>
            <%int srno=1; %>
  			
  			
            <s:iterator value="attrMatrixValue">
            
            <%=srno++ %>
            <s:if test="attrMatrixValue ==null"></s:if>
            <s:else>
            <s:property />
            <br>
            </s:else>
            
            
            </s:iterator>
            <%srno=1; %>
          	
-----------------
how i can put condition for that i am not good in ognl

please help me

-- 
View this message in context: http://www.nabble.com/hw-to-use-if-tag-tp19856372p19856372.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: hw to use if tag

Posted by Sébastien Domergue <se...@c-s.fr>.
Is your vector just a vector of value or is it an object vector with 
attribute fields? With attribute fields you should use the if tag as 
described before. In the other case, you have to use the var field of 
<s:iterator> that would create a variable to manipulate the value.

regards

Hardik Shah a écrit :
> when i write <s:if test="%{attrMatrixValue != null}">
>
> my all values are note printed
>
> it means each record has attrMatrixValue vector 
> but in it not each has value
>
> so i have to apply condition for the property of attrMatrixValue 
>
> help me,
> and <s:iterator value="attrMatrixValue" var="iterator"> 
> gives as it has no such thing like var(using struts 2.0.11.2)
>
>
>
>
>
>
> Sébastien Domergue wrote:
>   
>> Hi,
>>
>> in your test condition, struts doesn't understand that attrMatrixValue 
>> is a property, you should write something like :
>> <s:if test="%{attrMatrixValue != null}">
>> Using '%{' means that the expression have to be evaluated.
>>
>> Regards
>>
>> Sébastien
>>
>> Hardik Shah a écrit :
>>     
>>> hi
>>>
>>> i have vector of vector and i can easily iterate using  <s:iterate> in
>>> between <s:iterate>
>>>
>>> but the problem is that some of the element in vector of vector is null
>>>
>>> like
>>> ------------------------------------
>>> <s:iterator value="attributelist" id="attriblist">
>>>         <tr>
>>>         	 <td><s:property value="attrName"/></td>
>>>             <td><s:property value="attrValue"/></td>
>>>             <td><s:property value="attrType"/></td>
>>>             <td><s:property value="attrForIndiName"/></td>
>>>             <td><s:property value="userTypeName"/></td>
>>>             <td><s:property value="userInput"/></td>
>>>             <td><s:property value="remark"/></td>
>>>             <td>
>>>             <%int srno=1; %>
>>>   			
>>>   			
>>>             <s:iterator value="attrMatrixValue">
>>>             
>>>             <%=srno++ %>
>>>             <s:if test="attrMatrixValue ==null"></s:if>
>>>             <s:else>
>>>             <s:property />
>>>             <br>
>>>             </s:else>
>>>             
>>>             
>>>             </s:iterator>
>>>             <%srno=1; %>
>>>           	
>>> -----------------
>>> how i can put condition for that i am not good in ognl
>>>
>>> please help me
>>>
>>>   
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>     
>
>   


Re: hw to use if tag

Posted by Dave Newton <ne...@yahoo.com>.
The "var" attribute is Struts 2.1, use "id" if you're using Struts 2.0.

Dave

--- On Tue, 10/7/08, Hardik Shah <ha...@yahoo.com> wrote:
> when i write <s:if test="%{attrMatrixValue !=
> null}">
> 
> my all values are note printed
> 
> it means each record has attrMatrixValue vector 
> but in it not each has value
> 
> so i have to apply condition for the property of
> attrMatrixValue 
> 
> help me,
> and <s:iterator value="attrMatrixValue"
> var="iterator"> 
> gives as it has no such thing like var(using struts
> 2.0.11.2)
> 
> 
> 
> 
> 
> 
> Sébastien Domergue wrote:
> > 
> > Hi,
> > 
> > in your test condition, struts doesn't understand
> that attrMatrixValue 
> > is a property, you should write something like :
> > <s:if test="%{attrMatrixValue !=
> null}">
> > Using '%{' means that the expression have to
> be evaluated.
> > 
> > Regards
> > 
> > Sébastien
> > 
> > Hardik Shah a écrit :
> >> hi
> >>
> >> i have vector of vector and i can easily iterate
> using  <s:iterate> in
> >> between <s:iterate>
> >>
> >> but the problem is that some of the element in
> vector of vector is null
> >>
> >> like
> >> ------------------------------------
> >> <s:iterator value="attributelist"
> id="attriblist">
> >>         <tr>
> >>         	 <td><s:property
> value="attrName"/></td>
> >>             <td><s:property
> value="attrValue"/></td>
> >>             <td><s:property
> value="attrType"/></td>
> >>             <td><s:property
> value="attrForIndiName"/></td>
> >>             <td><s:property
> value="userTypeName"/></td>
> >>             <td><s:property
> value="userInput"/></td>
> >>             <td><s:property
> value="remark"/></td>
> >>             <td>
> >>             <%int srno=1; %>
> >>   			
> >>   			
> >>             <s:iterator
> value="attrMatrixValue">
> >>             
> >>             <%=srno++ %>
> >>             <s:if test="attrMatrixValue
> ==null"></s:if>
> >>             <s:else>
> >>             <s:property />
> >>             <br>
> >>             </s:else>
> >>             
> >>             
> >>             </s:iterator>
> >>             <%srno=1; %>
> >>           	
> >> -----------------
> >> how i can put condition for that i am not good in
> ognl
> >>
> >> please help me
> >>
> >>   
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> user-help@struts.apache.org
> > 
> 
> -- 
> View this message in context:
> http://www.nabble.com/hw-to-use-if-tag-tp19856372p19857035.html
> Sent from the Struts - User mailing list archive at
> Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org

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


Re: hw to use if tag

Posted by Hardik Shah <ha...@yahoo.com>.
when i write <s:if test="%{attrMatrixValue != null}">

my all values are note printed

it means each record has attrMatrixValue vector 
but in it not each has value

so i have to apply condition for the property of attrMatrixValue 

help me,
and <s:iterator value="attrMatrixValue" var="iterator"> 
gives as it has no such thing like var(using struts 2.0.11.2)






Sébastien Domergue wrote:
> 
> Hi,
> 
> in your test condition, struts doesn't understand that attrMatrixValue 
> is a property, you should write something like :
> <s:if test="%{attrMatrixValue != null}">
> Using '%{' means that the expression have to be evaluated.
> 
> Regards
> 
> Sébastien
> 
> Hardik Shah a écrit :
>> hi
>>
>> i have vector of vector and i can easily iterate using  <s:iterate> in
>> between <s:iterate>
>>
>> but the problem is that some of the element in vector of vector is null
>>
>> like
>> ------------------------------------
>> <s:iterator value="attributelist" id="attriblist">
>>         <tr>
>>         	 <td><s:property value="attrName"/></td>
>>             <td><s:property value="attrValue"/></td>
>>             <td><s:property value="attrType"/></td>
>>             <td><s:property value="attrForIndiName"/></td>
>>             <td><s:property value="userTypeName"/></td>
>>             <td><s:property value="userInput"/></td>
>>             <td><s:property value="remark"/></td>
>>             <td>
>>             <%int srno=1; %>
>>   			
>>   			
>>             <s:iterator value="attrMatrixValue">
>>             
>>             <%=srno++ %>
>>             <s:if test="attrMatrixValue ==null"></s:if>
>>             <s:else>
>>             <s:property />
>>             <br>
>>             </s:else>
>>             
>>             
>>             </s:iterator>
>>             <%srno=1; %>
>>           	
>> -----------------
>> how i can put condition for that i am not good in ognl
>>
>> please help me
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

-- 
View this message in context: http://www.nabble.com/hw-to-use-if-tag-tp19856372p19857035.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: hw to use if tag

Posted by Paweł Wielgus <po...@gmail.com>.
Hi,
there is also problem with:
<s:iterator value="attrMatrixValue">
and
<s:if test="attrMatrixValue ==null"></s:if>

it should be something like
<s:iterator value="attrMatrixValue" var="iterator">
<s:if test="iterator ==null"></s:if>

Read more about it here:
http://struts.apache.org/2.x/docs/tag-reference.html

Best greetings,
Paweł Wielgus.


2008/10/7 Sébastien Domergue <se...@c-s.fr>:
> Hi,
>
> in your test condition, struts doesn't understand that attrMatrixValue is a
> property, you should write something like :
> <s:if test="%{attrMatrixValue != null}">
> Using '%{' means that the expression have to be evaluated.
>
> Regards
>
> Sébastien
>
> Hardik Shah a écrit :
>>
>> hi
>>
>> i have vector of vector and i can easily iterate using  <s:iterate> in
>> between <s:iterate>
>>
>> but the problem is that some of the element in vector of vector is null
>>
>> like
>> ------------------------------------
>> <s:iterator value="attributelist" id="attriblist">
>>        <tr>
>>                 <td><s:property value="attrName"/></td>
>>            <td><s:property value="attrValue"/></td>
>>            <td><s:property value="attrType"/></td>
>>            <td><s:property value="attrForIndiName"/></td>
>>            <td><s:property value="userTypeName"/></td>
>>            <td><s:property value="userInput"/></td>
>>            <td><s:property value="remark"/></td>
>>            <td>
>>            <%int srno=1; %>
>>
>>
>>            <s:iterator value="attrMatrixValue">
>>                        <%=srno++ %>
>>            <s:if test="attrMatrixValue ==null"></s:if>
>>            <s:else>
>>            <s:property />
>>            <br>
>>            </s:else>
>>                                    </s:iterator>
>>            <%srno=1; %>
>>
>> -----------------
>> how i can put condition for that i am not good in ognl
>>
>> please help me
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

Re: hw to use if tag

Posted by Sébastien Domergue <se...@c-s.fr>.
Hi,

in your test condition, struts doesn't understand that attrMatrixValue 
is a property, you should write something like :
<s:if test="%{attrMatrixValue != null}">
Using '%{' means that the expression have to be evaluated.

Regards

Sébastien

Hardik Shah a écrit :
> hi
>
> i have vector of vector and i can easily iterate using  <s:iterate> in
> between <s:iterate>
>
> but the problem is that some of the element in vector of vector is null
>
> like
> ------------------------------------
> <s:iterator value="attributelist" id="attriblist">
>         <tr>
>         	 <td><s:property value="attrName"/></td>
>             <td><s:property value="attrValue"/></td>
>             <td><s:property value="attrType"/></td>
>             <td><s:property value="attrForIndiName"/></td>
>             <td><s:property value="userTypeName"/></td>
>             <td><s:property value="userInput"/></td>
>             <td><s:property value="remark"/></td>
>             <td>
>             <%int srno=1; %>
>   			
>   			
>             <s:iterator value="attrMatrixValue">
>             
>             <%=srno++ %>
>             <s:if test="attrMatrixValue ==null"></s:if>
>             <s:else>
>             <s:property />
>             <br>
>             </s:else>
>             
>             
>             </s:iterator>
>             <%srno=1; %>
>           	
> -----------------
> how i can put condition for that i am not good in ognl
>
> please help me
>
>