Hi,
I think 'sort' value is available from action class. If yes, when it is
directly available from action, you do not need to use <s:set />. U can
use the value from action itself.
ManiKanta
Kibo wrote:
Hi ManiKanta G
Thank for you replay. It help me.
But, the problem was in wrong return dateType.
The code below work correct.
-----------------------------------------------
<s:iterator value="%{page}">
<s:property value="label" />
<s:if test="%{label eq 'item2'}">
OK
</s:if>
</s:iterator>
--------------------------------------
The failure was that property return another dateType and it equals with
String value.
<s:if test='%{#sort eq "PRODUCT"}'>
The property sort is enum - ComponentName sort;
Solve was etc:
<s:iterator id="comp" value="%{components}">
<s:set name="sort" value="%{sort + ''}" />
<s:if test="%{#sort+'' eq 'PRODUCT'}">
OK
</s:if>
</s:iterator>
--------------------------------------------------
Thanks a lot
ManiKanta G wrote:
<s:property /> is like out.println(). It is useful for printing
(outputs) some value, but not to store a value.
To store a value in to the value stack (coz this is S2), you may use
<s:set name="" value="" /> where the name attribute indicates the name
of the variable and the value indicates the value to be store. You may
use another attribute 'scope' to tell the scope of the variable. Ref
http://struts.apache.org/2.x/docs/set.html
Ex:
<s:set name="flag" value="true" />
<s:if test="#flag">
<%-- Write your code here --%>
</s:if>
Here as the 'flag' variable is stored in the value stack, to access this
variable you will need to use the variable prefixed with #, like
#variableName
In some cases <s:push /> is useful. Please go through the doc for
<s:push /> which is used to push the current element into the top of the
value stack.
hope this helps.
ManiKanta
Kibo wrote:
Hi konference
I am already helpless.
How can I test the property in <s:if tag?
-----------------------------------------------------
<s:iterator id="comp" value="%{components}">
<s:property value="%{sort}" />
<s:if test='%{#sort eq "PRODUCT"}'>
OK
</s:if>
</s:iterator>
----------------------------------
Thanks a lot.
-----
Tomas Jurman
Czech Republic
********** DISCLAIMER **********
Information contained and transmitted by this E-MAIL is proprietary to
Sify Limited and is intended for use only by the individual or entity to
which it is addressed, and may contain information that is privileged,
confidential or exempt from disclosure under applicable law. If this is a
forwarded message, the content of this E-MAIL may not have been sent with
the authority of the Company. If you are not the intended recipient, an
agent of the intended recipient or a person responsible for delivering
the
information to the named recipient, you are notified that any use,
distribution, transmission, printing, copying or dissemination of this
information in any way or in any manner is strictly prohibited. If you
have
received this communication in error, please delete this mail & notify us
immediately at [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-----
Tomas Jurman
Czech Republic