suppose the following code:
ActionMessages errors = f.validate(mapping, request);
Iterator<ActionMessage> iter = errors.get();
while (iter.hasNext()) {
output.append(iter.next()+"<br />");
}
if the actionMessage points to a resource, how could I grab the string in the resource instead of printing the key?
Test if
isResource()returnstrue, and if so, callgetResources()and use the resultingMessageResourcesinstance to formate the message with its resource key and its values.Note that action messages are typically displayed from a JSP, and that the JSP should use the struts errors and messages tags to display the messages.