You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Barbara Post <ba...@ifrance.com> on 2002/06/17 16:35:38 UTC

html:errors issue

I have the following code in my jsp :

<tr>  <td><html:errors property="company"/></td></tr>
<tr>
 <td>Company:&nbsp;</td>
 <td align="right"><input id="company" name="company" size="15" tabindex="1"
value="">
        </td>
</tr>

******** I get the following printed out on my logon jsp :

Veuillez corriger les erreurs : ???fr_FR.Mandatory field : Company,???
Company: [here a text input field]

although I set the locale to en_US in my ActionForm (from a html:select). It
should normally print out only :

Mandatory field : Company
Company: [here a text input field]

********** The ApplicationResources_en_US.properties show :
errors.header<p>Please correct the following errors :<br>
missing.field=Mandatory field : {0}
errors.footer=</p>


*********** The ApplicationResources_fr_FR.properties show :
errors.header=<p>Veuillez corriger les erreurs : <br>
missing.field=Champ à renseigner : {0}
errors.footer=</p>

*********** my ActionForm bit of code (in validate() method) :

        MessageResourcesFactory mf;
        mf = MessageResourcesFactory.createFactory();
        msgResources = mf.createResources("ApplicationResources");
        }
        catch(Exception e){
        System.out.println(e);
        }

        ActionErrors errors = new ActionErrors();
        // get the fields on the form
        // fill an ActionErrors object

        String msg = new String(msgResources.getMessage(loc,
"missing.field")); // here loc is equal to en_US...
        try{
        userCompany =
request.getParameterValues("company")[0].toUpperCase();
        if(userCompany.equals("")){
            errors.add("company", new ActionError(msg, "Company"));
          }
        }

       catch(Exception e){
        }
// do the same for the other fields...


*****************
so it actually uses my default locale (which I don't use in my code...),
fr_FR for the header !! and why does it print out "?" and my fr_FR locale ?

Any idea of what I'm doing wrong ? Thanks a lot !
Struts 1.1 b1 and JDK 1.4.0 (Tomcat 4.0).

Barbara



 
______________________________________________________________________________
ifrance.com, l'email gratuit le plus complet de l'Internet !
vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP...
http://www.ifrance.com/_reloc/email.emailif



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>