This is interesting to say the least. I have a similar form where I MANUALLY PERFORM the validation and I stick in the message keys myself for a bunch of detail records. I add them via a helper function:
/** * Return the field name that represents the detail row that is in error * @param row * @param fieldname * @return */ protected String getDetailFieldName( int row, String fieldname ) { StringBuffer buff = new StringBuffer( "locationtestresults[" ); // the name of the arraylist property buff.append( row + "" ); buff.append( "]."); buff.append( fieldname ); String returnValue = buff.toString(); log.debug("getFieldName=" + returnValue ); return (returnValue); } // getDetailFieldName A message was added like this: if (t_begin_date == null ) { validateTestDates = false; // StrutsUtils.addError(errors, getDetailFieldName(i, "test_begin_date"), "validation.error.testreportform.nulltest_begin_date"); errors.add(getDetailFieldName(i, "test_begin_date"), new ActionMessage("validation.error.testreportform.nulltest_begin_date")); } The error class works fine on the front-end: .FieldError { background-color: red; } [...] <nested:text property="test_begin_date" size="11" maxlength="10" errorStyleClass="FieldError"/> I should try an example that is similar to use and see how it behaves. What do you use for the validation that is creating these keys? Struts Validator? Eric -----Original Message----- From: eugenebalt [mailto:eugeneb...@yahoo.com] Sent: Tuesday, July 07, 2015 3:45 PM To: user@struts.apache.org Subject: Re: Struts 1.3 errorStyleClass Not Working (Error Field Highlighting) So, I now have some more info about this problem, which could maybe help us debug it: If you open Struts' BaseHandlerTag.doErrorsExist(), which is called to set the Error Style, it looks like this. Note the very last statement, the &&-paired double condition for errorsExist. protected boolean doErrorsExist() throws JspException { boolean errorsExist = false; if (getErrorStyleId() != null || getErrorStyle() != null || getErrorStyleClass() != null) { String actualName = prepareName(); if (actualName != null) { ActionMessages errors = TagUtils.getInstance() .getActionMessages(pageContext, errorKey); errorsExist = (errors != null && errors.size(actualName) > 0); For me, the SECOND condition is false, while the first one is true. Condition #2 is not satisfied, because I have this: 1) actualName = "actionFormBean.contactPerson.firstName" 2) The Errors map holds a differently named string: { ... , contactPersonFirstName=[error.field.required[The Person to be contacted First Name]] , ... } So the actual key in the Errors Map is "contactPersonFirstName", but the 'actualName' var from prepareName() comes in as "actionFormBean.contactPerson.firstName". The key isn't found, so the highlight doesn't happen, and the style isn't applied. Any thoughts on this? -- View this message in context: http://struts.1045723.n5.nabble.com/Struts-1-3-errorStyleClass-Not-Working-Error-Field-Highlighting-tp5717942p5717943.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org