Reputation: 33
addActionMessage(" does not exist!");
How to avoid this message in JSP page showing all pages.
JSP:
<s:actionerror cssClass="MessageBox" theme="simple" />
</s:if>
<s:if test="hasActionMessages()">
<s:actionmessage cssClass="MessageBox" theme="simple" />
</s:if>
Upvotes: -1
Views: 333
Reputation: 1
If the action has action messages then they will be shown. You need to change the logic to decide whether action messages should be shown. Create a method in the action class that returns boolean
and is called when you need to test it. For example
private boolean showActionMessages;
public boolean isShowActionMessages(){
return hasActionMessages() && showActionMessages;
}
then change the if
tag
<s:if test="showActionMessages">
<s:actionmessage cssClass="MessageBox" theme="simple" />
</s:if>
Upvotes: 0
Reputation: 1963
ActionMessage is also Collection<String> getActionMessage() {... }
.so you can use iteator method.try this,
<s:iterator value="actionMessage" status="s">
<s:set var="S1" value="%{actionMessage.get(#s.index)}"/>
<s:if test="#S1.contains(' does not exist!')">
True
</s:if><s:else>
False
</s:else>
</s:iterator>
Upvotes: 0
Reputation: 5327
I think you have added
addActionMessage(" does not exist!");
in all action method
You should use different messages in each method of action class to get diffetent messages.
Upvotes: 0