struts2 jspページのアクションメッセージとアクションエラーをどのように装飾するかについて、strutsを初めて使用します。
<s:actionmessage/>
<s:actionerror/>
struts2 jspページのアクションメッセージとアクションエラーをどのように装飾するかについて、strutsを初めて使用します。
<s:actionmessage/>
<s:actionerror/>
cssスタイルとjqueryテーマ属性を使用して、アクションエラーとアクションメッセージを装飾できます。
<div class="error"><s:actionerror theme="jquery"/></div>
<div class="message"><s:actionmessage theme="jquery"/></div>
.message li
{
font-size: 14px;
color: #000066;
text-align: center;
list-style: none;
font-family: Trebuchet MS,sans-serif,inherit,Arial,monospace;
}
.error li
{
font-size: 14px;
color: #990000;
text-align: center;
list-style: none;
padding-right: 50px;
}
こんにちはここで私はあなたのアクションメッセージとエラーメッセージを飾って欲しいならあなたの問題の解決策を投稿していますこのコードを使用してください
<div id="sucessMsg"><s:actionerror /></div>
sucessMsg is the class that is using by struts2 internally so override this so kindly put the below code inside the css
#sucessMsg {
text-align: center;
font-weight: bolder;
color: #6A2A91;
list-style: none;
margin: auto;
}
#errorMsg {
text-align: center;
font-weight: bolder;
color: red;
list-style: none;
width: 350px;
margin: auto;
}
レンダリング後にHTMLソースを表示して、Strutsがメッセージのレンダリングに使用するCSSクラスとHTML構造を確認する必要があります。テンプレートファイルを調べることもできます。
デフォルトでは、strutsは各アクションメッセージを次のようにレンダリングします。
<ul>
<li><span class="actionMessage">${message}</span></li>
</ul>
すべてのメッセージには。があり <li><span class="actionMessage">${message}</span></li>
ます。
actionMessageのCSSを作成するか、テンプレートファイルを変更してこれらを必要に応じてレンダリングできます。
これらのテンプレートファイルは次の場所にあります。
/template/simple/actionerror.ftl
/template/simple/actionmessage.ftl
フィールドエラーも役立つ場合があります。
/template/simple/fielderror.ftl
注: xhtmlテーマを使用している場合、これらのファイルはテンプレートの下のそのフォルダーにある可能性があります