File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes s:if test troubles,  How to test these expression Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "s:if test troubles,  How to test these expression " Watch "s:if test troubles,  How to test these expression " New topic
Author

s:if test troubles, How to test these expression

Moli molina
Greenhorn

Joined: Apr 07, 2010
Posts: 19
How to test these expression:

If I do
<s:if test="%{sessionUser.role == 'A'}">

test evaluates correctly, but when a try to make a different:

<s:if test="%{sessionUser.role != 'A'}">

sessionUser.role is a char, not a string.


Many thanks for your time!

Richard Golebiowski
Ranch Hand

Joined: May 05, 2010
Posts: 213

I did a test app on Linux and Windows systems with Struts 2.1.8.1 using the following:


On Linux, I couldn't get anything to work. On Windows, it worked.
I even followed what is said here
Richard Golebiowski
Ranch Hand

Joined: May 05, 2010
Posts: 213

Did some more testing. I don't know what happened the first time, but the test code I posted is now working on my Linux system!
Moli molina
Greenhorn

Joined: Apr 07, 2010
Posts: 19
Thanks for your example and tests.

I think my troubles are other because my object is in session, but in my action, and jsp, I think this object isn't in session and never test well.
In other test I made your solution works well.

Thanks a lot!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: s:if test troubles, How to test these expression
 
Similar Threads
How to access static fields using OGNL in Struts 2
struts 2 s:if test tag
Taglib that translates into a series of other taglib calls
OGNL fixing precedence with ()