aspose file tools*
The moose likes Struts and the fly likes Issues with struts condition  tag, lil help please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Issues with struts condition  tag, lil help please" Watch "Issues with struts condition  tag, lil help please" New topic
Author

Issues with struts condition tag, lil help please

frank xxx
Greenhorn

Joined: Feb 11, 2006
Posts: 3
Gurus,

I am having problems using condition custom tag, based on jakarta struts 1.0
In the example below , the "balance_Amount" is string ( in form bean). The value I compare is with is double ( 0.1).

how do i go about writing?
The below code is not working. what are the laternatives I have here like logic:greaterThan tag?

<xx:if>
<xx:condition> <xx ataValue fieldName="balance_Amount"/> > "0.1" </xx:condition>
<xx:then>
.....
</xx:then>
</xx:if>
[ February 11, 2006: Message edited by: frank xxx ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I've been working with Struts for a long time, and I've never heard of the xx:if, or xx:condition tags. They must be in some other custom tag library you're using. For Struts, you'll want to use the <logic:equal> tag.

Here's a link to the 1.0 version of these tags:

http://struts.apache.org//struts-doc-1.0.2/api/org/apache/struts/taglib/logic/package-summary.html#package_description

You also have the option of using Java Standard Tag Library (JSTL) for this logic.


Merrill
Consultant, Sima Solutions
frank xxx
Greenhorn

Joined: Feb 11, 2006
Posts: 3
Thanks for you response Merril, I am new to struts.

Well, when I say <XX:if > its a custom tag and XX stands for company name.
I didnot want to mention that. But How could I use that conditin tag?
I checked the tld file theres nothing there except for definition. No attribues or anything.

How could I use <logical: greaterThan> tag to compare a string value ( eg. "2.0" )to a double value 0.1?
The balance type in my bean account is string.


eg

<logical: greaterThan> name="account" property="balance" value="0.1"
...
<logical: greaterThan>


Tnanks for you help?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The actual logic of a custom tag is in java classes that the .tld file points to. In your TLD, you will find <tagclass) and <teiclass> entries. Look in these classes for the actual logic of the tags.

Regarding the <logic:greaterThan> tag, the answer to your question is in the link that I gave you:

Each of the value comparison tags takes a value and compares it to the value of a comparison attribute. If the value given can be successfully converted to a float or double, then a number comparison is performed on the value given and the value of the comparison attribute. Otherwise a String comparison is performed.


Even if the property is a string, the tag does a number comparison if it can.
frank xxx
Greenhorn

Joined: Feb 11, 2006
Posts: 3
Thanks Merril, I will have to try it on monday
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Issues with struts condition tag, lil help please
 
Similar Threads
xslt question
input tag in WSAD for ANT
How is jsessionId handled when moving from http --> https?
know the current status of command button
How to replace a if(boolean) script with struts tag?