Re: struts 1.1 validation problem / question

2003-11-16 Thread Andreas Wuest
Hi Victor,

thanks for you reply.  the lookupdispatchaction does not really solve
my problem, since handling the different actions is not the problem.
the problems is the validation of the input fields for the different 
action. i need different validations depending on the value of the
userAction html form value.

thanks, 

 Andreas

On Sunday 16 November 2003 10:51, Victor wrote:
 Oi Andre,

 Tries to verify the LookupDispatchAction class, this
 class allows to manage diverse actions in simple
 Action and in this way you can better manage its
 validations with the Validator.

 Good code.
 Victor Amano Izawa

 __

 Yahoo! Mail: 6MB, anti-spam e antivĂ­rus gratuito! Crie sua conta agora:
 http://mail.yahoo.com.br

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


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



Re: struts 1.1 validation problem / question

2003-11-16 Thread Phil
Hi Andreas,

i think the best way is to write your own
validate() method in your action form. There you
can easily check the value of the userAction attribute
and depending on that the other attributes.

example:

public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {
  ActionErrors errors = new ActionErrors();

  if (getName().length()  1) {
   errors.add(ActionErrors.GLOBAL_ERROR, new
ActionError(form.error.name.required));
  }

  return errors;
 }

HTH

Phil

- Original Message -
From: Andreas Wuest [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, November 15, 2003 2:36 PM
Subject: struts 1.1 validation problem / question


 Hi,

 i have a small problem / question concerning the struts 1.1 validation.
 i have a jsp form that has the following input fields :

 id
 name
 password
 userAction

 Depending on the userAction value (can be 'show' or 'save') i need to
 validate only the id (when userAction is 'show') or the name, password
 and id (when the userAction is 'save').
 i have one form that contains the 4 properties (with getters and setters)
 and an action class that handles the show and the save action.

 the problem that i have is the validation. as far as i understand the
 docuemtneation it is not possible to validate a property only when
 another property has a certain value. in other words it is not possible
 to tell the validator to skip validation of a property when another
property
 has a certain value.
 or am i mistaken ?

 how can i solve this problem ? do i need 2 forms and action to handle the
 different userActions or is there another way ??

 Thanks in advance,

  Andreas


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



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