struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wes Wannemacher <w...@wantii.com>
Subject Re: struts2 ognl confusion
Date Wed, 05 Aug 2009 15:39:18 GMT
I think this would be more readable -

<s:iterator value="questions" status="status" var="question">
    <s:if test='incorrectQs.contains(#question.questionId)'>
        <div style="color: red; padding-bottom: 5px;">Print Something</div>
    </s:if>
</s:iterator>

-Wes

On Wed, Aug 5, 2009 at 11:35 AM, Bhaarat Sharma<bhaarat.s@gmail.com> wrote:
> I have the following code in a jsp
> Line1: <s:iterator value="questions" status="status">
> Line2:    <s:if test='incorrectQs.contains("${questionId}")'>
> Line3:        <div style="color: red; padding-bottom: 5px;">Print
> Something</div>
> Line4:    </s:if>
> Line5:</s:iterator>
>
> On Line1 questions is a list.  This list contains object of class Exam.
> Class Exam has a getter/setter questionId
> On Line2 incorrectQs is a list.  This list contains strings.
>
> I am checking to see if list in Line2 contains a questionId that is in
> questions list on line1.
>
> Is this the best way to do this?
>
> the code seems to be working but 'randomly' sometimes Line2 never seems to
> be true ...when we know it IS true.
>
> I just want to make sure with some experienced people whether this is the
> way to achieve this?
>



-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

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


Mime
View raw message