It's not a secret anymore!*
The moose likes Struts and the fly likes struts2 iterator status question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts2 iterator status question" Watch "struts2 iterator status question" New topic
Author

struts2 iterator status question

Nilesh Thali
Greenhorn

Joined: Jan 13, 2009
Posts: 16
Hello,
Just wondering if something like this is legal in strut2:

even though, while debugging, i can see that course.index and someVar are the same value, the if condition doesn't trigger.
is it not possible to compare the status index with a jsp variable?
Thanks,
Nilesh
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Why would you use a scriptlet variable for this?
Nilesh Thali
Greenhorn

Joined: Jan 13, 2009
Posts: 16
sorry, but a question like that doesn't even begin to help.
anyways, disregard the question - downloaded struts2 and xwork src, debugged and found out that the s:if test construct will only take specific literal or predefined constants.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

The "test" attribute will take any valid OGNL expression, which can be constants, literals, method calls, expressions, etc.

The point was that there's almost *never* any reason to use a scriptlet variable in this fashion, and that by answering the question and showing *why* you wanted to use a scriptlet variable for this, you might have learned a better way to do it.
vishwa venkat
Ranch Hand

Joined: Nov 22, 2003
Posts: 185
can you try test=%{#course.index == someVar}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts2 iterator status question