I try it again, from the beginning and now this works. I don know what
I do before but I am happy now. Thanks for David and Patrice to help me.
        Now I have a new (and diferent) problem. I construct the follow
validate() in a ActionForm class:


CODE BEGIN-----------------------------------

public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {

        ActionErrors errors = new ActionErrors();

        if ((username == null) || (username.length() < 1))
                errors.add("username", new ActionError("errors.nousername"));

        if ((password == null) || (username.length() < 1))
                errors.add("password", new
ActionError("errors.nopassword"));

        if ( !password.equals(again))
                errors.add("passwordagain",new
ActionError("errors.passwordnotmatch"));

        return errors;
}

CODE END----------------------------------------------------------------

...and I have the follow entrys on my message resource file:

FILE BEGIN
(application.properties)------------------------------------------

# -- standard errors --
errors.nousername=O campo username deve ser preenchido
errors.nopassword=O campo senha deve ser preenchido
errors.passwordnotmatch=As senhas digitadas devem ser iguais
errors.header=<UL>
errors.prefix=<LI>
errors.suffix=</LI>
errors.footer=</UL>
# -- validator --
errors.invalid={0} is invalid.
errors.maxlength={0} can not be greater than {1} characters.
errors.minlength={0} can not be less than {1} characters.
------------------------------------------------------------------

.... The behavior on form looks like OK, but the messages (inside the
<li> and </li>) are empty. No errors, behavior ok but empty Strings.
Please, can someone help to me again? Thanks a lot.



Patrice wrote:
> 
> ----- Original Message -----
> From: "Jim Bruno Goldberg" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, November 26, 2002 6:27 PM
> Subject: perform() or execute()?
> 
> > Hi, people!
> >
> > I am trying to develop a little system in struts for 3 weeks now and I
> > can't solve some (very basic) problems. I try read the documentations,
> > but some I can resolve anyway. Please, I need some help!
> > My questions:
> >
> > 1. When I try to use the execute() in a Action, the method is nota
> > called. When I try with perform() works fine, but I known this is
> > deprecaced..... (I try struts 1.0.2 and now struts 1.1 - same result).
> 
> The  method has been deprecated since struts 1.1: so it can't work in struts
> 1.0.2
> 
> > 2. I try to prepopulate a form (request scope) and does not works. I
> > try to set: request.setAttribute("myfield","myvalue"), and nothing.
> 
> To populate a form from an action, you need to cast the ActionForm passed as
> parameter to the perform (or execute) method of your action and then, set
> the different properties to the appropriate values:
> for example:
> 
> MyForm myForm = (MyForm) form;
> myForm.setMyField("myValue");
> 
> > 3. To prepopulate a Form, I must to call a Action, prepopulate a bean
> > and then call a Form? That right?
> 
> I don't know what you mean with "call a Form".
> You just need to set the properties of the form with the values you want
> Then, the taglib will display the values in the field of the form, on your
> JSP.
> 
> >
> > Please, I need some help. Thanks to all.
> >
> 
> Hope it helps
> Patrice
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

-- 
        CUL8R,[]s
    Jim Bruno Goldberg
http://www.prosites.com.br

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to