wood burning stoves 2.0*
The moose likes Struts and the fly likes Problem using <s:if tag of Struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem using <s:if tag of Struts2" Watch "Problem using <s:if tag of Struts2" New topic
Author

Problem using <s:if tag of Struts2

Abdul Mujeeb Md
Greenhorn

Joined: Aug 25, 2008
Posts: 26
Hi,

I am trying to use <s:if> tag, but it doesn't work.



prints me, a value 'D'

In this case the If condition has to fail and the "Inside If" should not be printed. But the code evaluates the condition successfully and prints "Inside If".

Where am I making a mistake?

Thanks.


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

http://struts.apache.org/2.1.6/docs/why-wont-the-if-tag-evaluate-a-one-char-string.html
Abdul Mujeeb Md
Greenhorn

Joined: Aug 25, 2008
Posts: 26
Thanks for your reply David. It still doesn't work.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Abdul Mujeeb Md wrote:Thanks for your reply David. It still doesn't work.

That's not enough information to help solve your issue. I'd need current code, the types of the data you're comparing, etc. The <s:if> tag works fine if given appropriate comparisons.
Abdul Mujeeb Md
Greenhorn

Joined: Aug 25, 2008
Posts: 26
Hi David,

is a ArrayList containing a String Array.


Now I pass access this value in the jsp to evaluate the condition for the value of strData[3] which is "D". It causes the problem.

Hope I have provided you with sufficient information.

Thanks.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Try using the "#" notation inside the if tag.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem using <s:if tag of Struts2