Brian Ferris wrote:
I'm not sure what that Struts Taglib "way" to do the following task
would look like:
I've got a bean on the ValueStack with a "boolean isActive()" getter.
When active, I'd like to construct html like:
And when in-active, I'd like to construct:
The only real difference is the class attribute, which always has a
"baseStyle" class, but should also have an "active" class when the bean
is active.
Using struts taglibs inside a JSP, what's the easiest way to make that
construction? I have some ideas... but they all seem kind of akward.
The easiest way is using JSTL instead:
...
You can do the equivalent using struts tags + OGNL, which would look
something like
">...
It's more cumbersome, and you'd have to work out from the OGNL docs
exactly what you need to substitute for #{...} [does OGNL support the
ternary operator?].
However, it may be better to introduce semantic markers for
active/inactive and use something like