Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Struts
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Struts
s:if test troubles, How to test these expression
Moli molina
Greenhorn
Posts: 19
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
Posts: 213
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I did a test app on Linux and Windows systems with
Struts
2.1.8.1 using the following:
//in the action private char testChar; public String execute() throws Exception { this.testChar = 'A'; return ActionSupport.SUCCESS; } //in the jsp <s:if test="%{testChar == 'A'}"> char = A </s:if> <s:if test="%{testChar != 'B'}"> char != B </s:if>
On Linux, I couldn't get anything to work. On Windows, it worked.
I even followed what is said
here
Richard Golebiowski
Ranch Hand
Posts: 213
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
Posts: 19
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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!
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
s:if Question
How to access static fields using OGNL in Struts 2
OGNL fixing precedence with ()
how to know if has validation errors on jsp
Null Point Exception
Taglib that translates into a series of other taglib calls
How to do s:if test of a value in the iterator?
Struts 2 - conditional check of IteratorStatus inside an s:if tag
struts 2 s:if test tag
More...