I am trying to display error messages and the are displaying but not correctly. They display like this:
???en_US.Invalid userId or Password???
Here is the code that I use to fill the errors:
<code>
public class BaseAction extends Action {
public static final String APP_WARNING_KEY = "APP_WARNING_KEY";
public static final String APP_ERROR_KEY = "APP_ERROR_KEY";
protected void saveAppWarnings(HttpServletRequest request, ActionMessages messages) {
saveAppMessages(request, messages, APP_WARNING_KEY);
}
protected void saveAppErrors(HttpServletRequest request, ActionMessages messages) {
saveAppMessages(request, messages, APP_ERROR_KEY);
}
private void saveAppMessages(HttpServletRequest request, ActionMessages messages, String key) {
// Remove any messages attribute if none are required
if ((messages == null) || messages.isEmpty()) {
request.removeAttribute(key);
return;
}
// Save the messages we need
request.setAttribute(key, messages);
}
</code>
And here is the code that I use to display the messages:
<code>
<logic:messagesPresent name="APP_ERROR_KEY">
<table border="1" bgcolor="orange" width="100%" align="center"><tr><td>
<p>
<img src="images/icon-alert.gif" border="0" vspace="2" hspace="10" align="center">
<bean:message bundle="errors" key="ERRORS_HEADING"/>
</p>
<ul>
<html:messages id="error" name="APP_ERROR_KEY">
<li><bean:write name="error"/></li>
</html:messages>
</ul>
</td></tr></table>
<p>
</logic:messagesPresent>
<logic:messagesPresent name="APP_WARNING_KEY">
<table border="1" bgcolor="yellow" width="100%" align="center"><tr><td>
<p>
<img src="images/icon-warning.gif" border="0" vspace="2" hspace="10" align="center">
<bean:message key="warnings.heading"/>
</p>
<ul>
<html:messages id="error" name="APP_WARNING_KEY">
<li><bean:write name="error"/></li>
</html:messages>
</ul>
</td></tr></table>
<p>
</logic:messagesPresent>
</code>
Can anyone suggest what it is theat my messages are looking for and how I can get rid of the "???en_US."?
???en_US.Invalid userId or Password???
Here is the code that I use to fill the errors:
<code>
public class BaseAction extends Action {
public static final String APP_WARNING_KEY = "APP_WARNING_KEY";
public static final String APP_ERROR_KEY = "APP_ERROR_KEY";
protected void saveAppWarnings(HttpServletRequest request, ActionMessages messages) {
saveAppMessages(request, messages, APP_WARNING_KEY);
}
protected void saveAppErrors(HttpServletRequest request, ActionMessages messages) {
saveAppMessages(request, messages, APP_ERROR_KEY);
}
private void saveAppMessages(HttpServletRequest request, ActionMessages messages, String key) {
// Remove any messages attribute if none are required
if ((messages == null) || messages.isEmpty()) {
request.removeAttribute(key);
return;
}
// Save the messages we need
request.setAttribute(key, messages);
}
</code>
And here is the code that I use to display the messages:
<code>
<logic:messagesPresent name="APP_ERROR_KEY">
<table border="1" bgcolor="orange" width="100%" align="center"><tr><td>
<p>
<img src="images/icon-alert.gif" border="0" vspace="2" hspace="10" align="center">
<bean:message bundle="errors" key="ERRORS_HEADING"/>
</p>
<ul>
<html:messages id="error" name="APP_ERROR_KEY">
<li><bean:write name="error"/></li>
</html:messages>
</ul>
</td></tr></table>
<p>
</logic:messagesPresent>
<logic:messagesPresent name="APP_WARNING_KEY">
<table border="1" bgcolor="yellow" width="100%" align="center"><tr><td>
<p>
<img src="images/icon-warning.gif" border="0" vspace="2" hspace="10" align="center">
<bean:message key="warnings.heading"/>
</p>
<ul>
<html:messages id="error" name="APP_WARNING_KEY">
<li><bean:write name="error"/></li>
</html:messages>
</ul>
</td></tr></table>
<p>
</logic:messagesPresent>
</code>
Can anyone suggest what it is theat my messages are looking for and how I can get rid of the "???en_US."?