Hi, I had the same problem. I did not like the way the error were being displayed (In a new row above the field that has the error) To do this I have to chenge the XHTML template
First I removed the validation from the controlheader-core <#-- REMOVED We have our own Error area <#if hasFieldErrors> <#list fieldErrors[parameters.name] as error> <tr errorFor="${parameters.id}"> <#if parameters.labelposition?default("") == 'top'> <td align="left" valign="top" colspan="2"><#rt/> <#else> <td align="center" valign="top" colspan="2"><#rt/> </#if> <span class="errorMessage">${error?html}</span><#t/> </td><#lt/> </tr> </#list> </#if> --> I added this to the form.ftl <#include "/${parameters.templateDir}/xhtml/validationarea.ftl" /> In that file I wrote the following code: It output all of the error into a single div. 'Holder Div' is used so the client side validations will work too. <#assign hasErrors = fieldErrors?exists/> <div id="holderDiv"> <#if hasErrors> <#if (fieldErrors?size > 0) > <div class="errorMessage" id="errorDiv" name="errorDiv"> <#assign keys = fieldErrors?keys> <#list keys as key> <#list fieldErrors[key] as errorMessage> ${errorMessage?html} <br/> </#list> </#list> </div> <br/> </#if> </#if> </div> Next I had to change the validation.js file to use my div to display the errors: function addError(e, errorText) { try { var errorDiv; var error = document.createTextNode(errorText); var br = document.createElement("br"); //Create the errorDiv it it does not already exist if(!document.getElementById("errorDiv")) { errorDiv = document.createElement("div"); errorDiv.setAttribute("id", "errorDiv"); errorDiv.setAttribute("class", "errorMessage"); errorDiv.setAttribute("className", "errorMessage"); //ie hack cause ie does not support setAttribute } else { errorDiv = document.getElementById("errorDiv"); } errorDiv.appendChild(error); errorDiv.appendChild(br); //Make sure all error moessage are display before showing the div if(!document.getElementById("errorDiv")) { document.getElementById("holderDiv").appendChild(errorDiv); } } catch (e) { alert(e); } } function clearErrorMessages(form) { var errorDiv; var errorDivChildren; if(document.getElementById("errorDiv")) { errorDiv = document.getElementById("errorDiv"); document.getElementById("holderDiv").removeChild(errorDiv); } } I commented out all of the logic in clearErrorLabels() since it does not apply to what I am doing. I think thats about everything. There might be one or 2 places you have to change some code in the template. The big thing here is you have to change the XHTML template. I'm not sure if the simple template has error handling, it might be easier to change. Rich On 7/27/07, M.Liang Liu <[EMAIL PROTECTED]> wrote: > Hi,all: > I would like to add header and footer to the actionerrors so as to it can > display in the way my client like. > In Struts1.2,i can just put the following code in the properties file: > ---------------------------------------------------------------------------------------------------- > errors.header=<table class="warning"><tr><td> > errors.prefix=<li> > errors.suffix=</li> > errors.footer=</td></tr></table> > ---------------------------------------------------------------------------------------------------- > and it could work as I excepted. > Now i am trying to use struts2,but it can NOT work in the same way. > > Any help? > > > btw,I have put the code in the globalMessages.properties and put the file in > the classpath,as well as defined the struts.xml as: > <constant name="struts.custom.i18n.resources" value="globalMessages" /> > > Thanks for reading and looking forward to any reply. > > -- > ------M.Liang Liu > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]