0

Struts2テキストフィールドのスタイルを動的に変更して、特定の条件に応じて背景色を変更しようとしています。

  • 質問 1 - これは可能ですか
  • 質問 2 - ここの他の投稿から - 次のことを試しましたが、スタイルが評価されませんか?

これを行う方法や、以下で間違っていることについての指針はありますか?

<s:if test='%{contactStatusCode == "ARE" }'>
<s:set var="AREStyle" value="%{'background:#eeeeee'}"/>

<s:textfield name      = "followUpComment"
             id        = "followUpComment[%{#index.index}]"
             style     = "%{#AREStyle}"
             size      = "15"
             maxlength = "100"  />
4

1 に答える 1

1

テキストフィールドのcssクラスを変更するのはどうですか

 <s:textfield name="followUpComment" cssClass="%{contactStatusCode == 'ARE' ? 'areClass' : 'notAreClass'}" />
于 2012-10-19T21:38:18.470 に答える