Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
How can I make to use dinamic values with equal tag, for example: <bean efine id="string" value="<%=1%>" /> <logic:equal name="string" value="1"> The string contained the wordStruts </logic:equal> in this case, don't print "The string contained the word Struts" at my scren, but if I change the <bean efine id="string" value="<%=1%>" /> for <bean efine id="string" value="1" /> it's work ok (print the message), What I need to do for make this work fine, I need the dinamic values for compare, maybe I don't need the <bean efine id="string" value="<%=1%>" />, just compare the logic:equal value with other number, but I don't know what attribute should use for it, parameter="<%=dinamicValue%>" or ??? Cheers Daniel S.
string is just the java bean object name. In this java bean, there are couples of attributes/properties. Therefore, logic:equal is to check the property in this java bean is equal to a value you specified. e.g. <logic:equals name="person" property="age" value="30"> I am 30 years old. </logic:equals> it will expect there is getter method in this java bean object, person, called getAge(). This is all I know. Hope it can help you. Benson
To dynamically take different paths in your jsp with logic:equal you need a bean that gets its value from somewhere else in the application. So, for example, if there is a bean in some scope that has been set in an action: String yesno = null; if (a == "Bob") yesno = "yes"; else yesno = "no"; request.getSession().setAttribute("RESULT", yesno); then tags like these might make sense:
<logic:equal name="RESULT" value="yes" > <td>Written by Bob</td> </logic:equal> <logic:equal name="RESULT" value="no" > <td>Not written by Bob</td> </logic:equal>
ok, but my problem is: I'm use the equal inside the logic:iterate and print 3 html coluns and change line, something like this (modulos is a Vector): <%int rest=0;%> <logic:iterate id="listModulos" name="modulos" indexId="index" > <% int line = index.intValue() % 3; %> <%=line%> <logic:equal parameter="<%=line%>" value="<%=rest%>" > <br> Printed <here I'll get attribute of my bean>! </logic:equal>
<logic:notEqual parameter="<%=line%>" value="<%=rest%>" > Printed <here I'll get attribute of my bean>!! </logic:notEqual>
</logic:iterate> If someone have other ideia to make it with logic:iterate .... cheers Daniel S.