Link to home
Start Free TrialLog in
Avatar of mvkraju
mvkraju

asked on

how do we use <logic:equal> tag?

Hi,

I have code like this

<logic:iterate id="hdrVec" name="<%=WebConstants.MESSAGE_COUNTS_HDR %>" offset="0" length="1"  > <bean:write name="hdrVec" /> </logic:iterate>

Now i want use empty tag with in the <logic:iterate> tag

like
<logic:iterate id="hdrVec" name="<%=WebConstants.MESSAGE_COUNTS_HDR %>" offset="0" length="1"  > if this element is equal to "" then <bean:write name="hdrVec" /> else
just empty string i.e "" </logic:iterate>

please give me some code how do we use <logic:equal> tag in this scenario

thanks
Avatar of jarasa
jarasa
Flag of Spain image

Something like this:

<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<!-- Is the number guess right? -->
<logic:equal parameter="number" value="7">
  You guessed right! You win a high speed blender!
</logic:equal>

<!-- If the number guessed was wrong -->
<logic:notEqual parameter="number" value="7">
  <!-- Less Than -->
  <logic:lessThan parameter="number" value="7">
         A little higher...
  </logic:lessThan>
  <!-- Greater Than -->
  <logic:greaterThan parameter="number" value="7">
         A little lower...
  </logic:greaterThan>
</logic:notEqual>

Javier
Avatar of mvkraju
mvkraju

ASKER

For the given example i used offset="0" length="1" in the <logic:iterate> tag
in that case i am retrieving the first element from the collection.

here i don't know the parameter name, just i know the what idex it is

So what will be the parameter in this case?

ASKER CERTIFIED SOLUTION
Avatar of kennethxu
kennethxu

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mvkraju

ASKER

can i user offset and length attributes for the <logic:equal> tag?

if so i got solution for my problem.
Avatar of mvkraju

ASKER

<logic:equal name="hdrVec" value="">
 dothis
</logic:equal>

is working for me, just i need to put this logic between my <logic:iterate> tag