Of course not; you cannot nest one JSP tag inside another JSP tag. In the
*body content* of a tag, sure.

HTML elements are not JSP tags, which is why it works in a normal HTML
element. (Side note, make sure you're aware of what things in a JSP page
are, where they come from, where they're executed/evaluated, etc.)

You can use <s:set> etc. to create new variables which you can refer to
inside S2 tags (untested, but relatively close, maybe?):

<s:set var="foo" value="'a-style'"/>
<s:textfield cssClass="%{#foo}"/>

You can also use OGNL's ternary expression, but IMO only do that if it's
still readable and not a million characters long.

Dave

On Sun, Jun 3, 2012 at 10:43 AM, samsongbest <[email protected]> wrote:

> Can I use <s:if> in <s:textfield> to control using different cssClass?
> Always failed when I tried.
> But it works in <input type="text">.
>
>
>
>
>
> Sam

Reply via email to