Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how do we use <logic:equal> tag?

Posted on 2004-04-01
5
Medium Priority
?
14,713 Views
Last Modified: 2013-11-19
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
0
Comment
Question by:mvkraju
  • 3
5 Comments
 
LVL 6

Expert Comment

by:jarasa
ID: 10732645
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
0
 

Author Comment

by:mvkraju
ID: 10733445
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?

0
 
LVL 14

Accepted Solution

by:
kennethxu earned 80 total points
ID: 10734162
is this what you are looing for?

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

Author Comment

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

if so i got solution for my problem.
0
 

Author Comment

by:mvkraju
ID: 10735227
<logic:equal name="hdrVec" value="">
 dothis
</logic:equal>

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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question