In my Struts 2 application following tags generating ul
li
span
tags, I have to avoid it. How it could possible? I am also used theme="simple"
, it doesn't work.
<s:actionmessage />
<s:actionerror />
Use iterator tag to iterate actionMessages
or actionErrors
. The action should extend ActionSupport
.
<s:iterator value="actionMessages">
<s:property/><br/>
</s:iterator>
<s:iterator value="actionErrors">
<s:property/><br/>
</s:iterator>
Iterate them and print each message / error manually, with the HTML you like:
<s:if test="hasActionMessages()">
<div id="messagesDiv" style="border: 10px solid green;">
<s:iterator value="actionMessages">
<span class="actionMessage">
<s:property />
</span>
</s:iterator>
</div>
</s:if>
<s:if test="hasActionErrors()">
<div id="errorsDiv" style="border: 10px solid red;">
<s:iterator value="actionErrors">
<span class="errorMessage">
<s:property />
</span>
</s:iterator>
</div>
</s:if>
The <span>
(or some other tag) should be kept, in order to semantically separate the messages (to decorate them with a different CSS style tomorrow, for example, which you are unable to do by printing them as simple text).
Otherwise, simply remove the <span>
and add a <br>
after the <s:property/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With