but my version < 2.1.6 On Wed, Aug 5, 2009 at 12:53 PM, <[email protected]> wrote:
> but in this document > http://struts.apache.org/2.1.6/docs/iterator.html > id attribute is deprecated. > > Louis > > > ________________________________ > From: Chris Pratt <[email protected]> > To: Struts Users Mailing List <[email protected]> > Sent: Wednesday, August 5, 2009 4:54:31 PM > Subject: Re: struts2 ognl confusion > > You must be using a fairly old version of Struts 2. The difference between > the ${} and the # versions is that the ${} is a JSTL EL expression that is > no longer allowed inside struts (s:) tags for security reasons. The # > version is OGNL and references the variable that Wes tried to define. Try > using the id attribute instead of the var attribute. So something more > like > this: > > <s:iterator value="%{questions}" status="status" id="question"> > <s:if test='%{incorrectQs.contains(#question.questionId)}'> > <div style="color: red; padding-bottom: 5px;">Print Something</div> > </s:if> > </s:iterator> > > I like to make it obvious which attributes use OGNL by enclosing them in > %{} > (*Chris*) > > On Wed, Aug 5, 2009 at 8:43 AM, Bhaarat Sharma <[email protected]> > wrote: > > > oh and attribute 'var' seems to be invalid according to the TLD > > > > On Wed, Aug 5, 2009 at 11:42 AM, Bhaarat Sharma <[email protected]> > > wrote: > > > > > ok thanks Wes. yeah that is def. more readable. > > > could you please tell me what the difference is in doing > > > <s:if test='incorrectQs.contains("${questionId}")'> > > > VS. > > > <s:if test='incorrectQs.contains(#question.questionId)'> > > > > > > beside the question.questionId part. I am more concerned about > difference > > > in '$' vs. '#' > > > > > > > > > On Wed, Aug 5, 2009 at 11:39 AM, Wes Wannemacher <[email protected]> > > wrote: > > > > > >> 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<[email protected]> > > >> 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: [email protected] > > >> For additional commands, e-mail: [email protected] > > >> > > >> > > > > > >

