You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Lukasz Lenart <lu...@apache.org> on 2013/11/19 08:06:10 UTC

Re: Struts 2, session, s:iterator s:if not working, please help (this is revised)

Have you tried to use <s:debug/> tag?

2013/11/19 john lee <sh...@yahoo.com>:
>
>
> from the following output,
>        we can tell sell_price=36.97, display_price=1
>
> why
>        none of test statement works ?
>
>
> please advise, thanks in advance
>
> john
>
>
>
> Class Part {
>                 float sell_price;
>                 int display_price;
>                 ./*..get set here ....*/
>
> Action.java
>          ArrayList<Part> parts=new ArrayList<Part>();
>          ...../* doing some calculation for multiple part*/
>          session.put("detailpart",parts);
>
> JSP file
>         <s:iterator id="part" value="#session.detailpart">
>                  why<s:property value="sell_price"/>- <s:property value="display_price"/>why
>
>              <s:if test='%{#part.display_price==1}'>
>                                  9<s:property value="sell_price"/>9
>              </s:if>
>
>             <s:if test='#part.display_price==1'>
>                                 8<s:property value="sell_price"/>8
>               </s:if>
>
>               <s:if test='part.display_price==1'>
>                                  7<s:property value="sell_price"/>7
>               </s:if>
>
>                <s:if test='%{#display_price==1}'>
>                                 6<s:property value="sell_price"/>6
>                </s:if>
>
>                <s:if test='#display_price==1'>
>                                  5<s:property value="sell_price"/>5
>                </s:if>
>               end
>         </s:iterator>
>
> OutPut
>
>
> why 36.97- 1 why                                                                                                                                                                                                                    end

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


Re: Struts 2, session, s:iterator s:if not working, please help (this is revised)

Posted by Antonios Gkogkakis <gk...@tcd.ie>.
Hi John,

You have to use var instead of id in the s:iterator tag.

Antonios


On 19 November 2013 07:06, Lukasz Lenart <lu...@apache.org> wrote:

> Have you tried to use <s:debug/> tag?
>
> 2013/11/19 john lee <sh...@yahoo.com>:
> >
> >
> > from the following output,
> >        we can tell sell_price=36.97, display_price=1
> >
> > why
> >        none of test statement works ?
> >
> >
> > please advise, thanks in advance
> >
> > john
> >
> >
> >
> > Class Part {
> >                 float sell_price;
> >                 int display_price;
> >                 ./*..get set here ....*/
> >
> > Action.java
> >          ArrayList<Part> parts=new ArrayList<Part>();
> >          ...../* doing some calculation for multiple part*/
> >          session.put("detailpart",parts);
> >
> > JSP file
> >         <s:iterator id="part" value="#session.detailpart">
> >                  why<s:property value="sell_price"/>- <s:property
> value="display_price"/>why
> >
> >              <s:if test='%{#part.display_price==1}'>
> >                                  9<s:property value="sell_price"/>9
> >              </s:if>
> >
> >             <s:if test='#part.display_price==1'>
> >                                 8<s:property value="sell_price"/>8
> >               </s:if>
> >
> >               <s:if test='part.display_price==1'>
> >                                  7<s:property value="sell_price"/>7
> >               </s:if>
> >
> >                <s:if test='%{#display_price==1}'>
> >                                 6<s:property value="sell_price"/>6
> >                </s:if>
> >
> >                <s:if test='#display_price==1'>
> >                                  5<s:property value="sell_price"/>5
> >                </s:if>
> >               end
> >         </s:iterator>
> >
> > OutPut
> >
> >
> > why 36.97- 1 why
>
>
>    end
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>