struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eugenebalt <eugeneb...@yahoo.com>
Subject Re: Struts 1.3 errorStyleClass Not Working (Error Field Highlighting)
Date Tue, 07 Jul 2015 19:44:33 GMT
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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message