RE: Validation problem

2004-02-03 Thread Jiin-Her Lu
This is an interesting thing. Here is the way to avoid Struts calls  validate method 
on ActionForm

This one Struts framework will NOT call validate method on ActionForm

html:cancel value=Cancel /

While this one does 

html:cancel property=mycancelbutton value=Cancel /

The only difference is if you do have property, Struts adds name=your_data. While if 
you don't have property set, Struts add name=org.apache.struts.taglib.html.CANCEL. 

Why these make the difference?



Jiin-Her Lu
(816) 926-2145

 [EMAIL PROTECTED] 01/29/04 05:45PM 
The Struts Validator provides a mechanism to deal with Cancel buttons. A
flag is set in the onclick method for the cancel button in the jsp page. The
validate methods check this flag and if it is set, they skip validation and
just return true.
 
html:cancel onclick=bCancel=true;

If you're not using the Struts Validator, maybe you could try mimicking this
behavior in your validate method ??

Brian Barnett

-Original Message-
From: Nathan Pitts [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 29, 2004 4:16 PM
To: Struts List
Subject: Validation problem

I am wondering how to solve the following problem with a minimal amount 
of recoding, and hope someone can give some input.  I have a form the 
has three html:submit buttons -- Update, Cancel and Delete.   I am 
using a LookupDispatchAction and an ActionForm with the validation in 
the validate() method.  Under normal conditions everything works 
fine..But when a user clicks Update with invalid data on the form, 
the validate method catches the bad data and returns the proper error 
message.  If the user then decides to click Cancel (without changing 
the invalid data), the validate() method is still called and the user 
is returned the same error.


One thing that I might be able to do is to somehow find out what button 
was clicked in the validate() method...??  How would I do that, I 
wonder...



thanks in advance,
-nathan


-
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] 



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



RE: Validation problem

2004-01-29 Thread Robert Taylor
What's the name of your Cancel button? Struts should not validate
if it finds org.apache.struts.taglib.html.CANCEL or
org.apache.struts.taglib.html.CANCEL.x

Take a look at the RequestProcessor.processValidate() code:

 if (request.getAttribute(Globals.CANCEL_KEY) != null) {
if (log.isDebugEnabled()) {
log.debug( Cancelled transaction, skipping validation);
}
return (true);
}

That attribute gets set in RequestProcessor.processPopulate():

 // Set the cancellation request attribute if appropriate
if ((request.getParameter(Constants.CANCEL_PROPERTY) != null) ||
(request.getParameter(Constants.CANCEL_PROPERTY_X) != null)) {
request.setAttribute(Globals.CANCEL_KEY, Boolean.TRUE);
}

robert

 -Original Message-
 From: Nathan Pitts [mailto:[EMAIL PROTECTED]
 Sent: Thursday, January 29, 2004 6:16 PM
 To: Struts List
 Subject: Validation problem
 
 
 I am wondering how to solve the following problem with a minimal amount 
 of recoding, and hope someone can give some input.  I have a form the 
 has three html:submit buttons -- Update, Cancel and Delete.   I am 
 using a LookupDispatchAction and an ActionForm with the validation in 
 the validate() method.  Under normal conditions everything works 
 fine..But when a user clicks Update with invalid data on the form, 
 the validate method catches the bad data and returns the proper error 
 message.  If the user then decides to click Cancel (without changing 
 the invalid data), the validate() method is still called and the user 
 is returned the same error.
 
 
 One thing that I might be able to do is to somehow find out what button 
 was clicked in the validate() method...??  How would I do that, I 
 wonder...
 
 
 
 thanks in advance,
 -nathan
 
 
 -
 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: Validation problem

2004-01-29 Thread Barnett, Brian W.
The Struts Validator provides a mechanism to deal with Cancel buttons. A
flag is set in the onclick method for the cancel button in the jsp page. The
validate methods check this flag and if it is set, they skip validation and
just return true.
 
html:cancel onclick=bCancel=true;

If you're not using the Struts Validator, maybe you could try mimicking this
behavior in your validate method ??

Brian Barnett

-Original Message-
From: Nathan Pitts [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 29, 2004 4:16 PM
To: Struts List
Subject: Validation problem

I am wondering how to solve the following problem with a minimal amount 
of recoding, and hope someone can give some input.  I have a form the 
has three html:submit buttons -- Update, Cancel and Delete.   I am 
using a LookupDispatchAction and an ActionForm with the validation in 
the validate() method.  Under normal conditions everything works 
fine..But when a user clicks Update with invalid data on the form, 
the validate method catches the bad data and returns the proper error 
message.  If the user then decides to click Cancel (without changing 
the invalid data), the validate() method is still called and the user 
is returned the same error.


One thing that I might be able to do is to somehow find out what button 
was clicked in the validate() method...??  How would I do that, I 
wonder...



thanks in advance,
-nathan


-
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: validation problem

2004-01-16 Thread Matthias Wessendorf
hi kelly,

did you integrate it into
struts-config?

--

plug-in
className=org.apache.struts.validator.ValidatorPlugIn
set-property
property=pathnames

value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/
/plug-in

greetings

-Original Message-
From: Kelly Goedert [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 16, 2004 11:25 AM
To: Struts Users Mailing List
Subject: validation problem


Hi,

I'm trying to use the validator in a form that is used in as login form 
for authentication.
And the fields are not being checked.

I have this mapping on struts-config.xml

!-- Form Bean Definitions --
form-beans
form-bean name=loginForm 
type=org.apache.struts.validator.DynaValidatorForm
form-property name=txtLogin type=java.lang.String/
form-property name=pwdSenha type=java.lang.String/
/form-bean
/form-beans

action path=/login
type=LoginAction
name = loginForm
scope=request
input=/login.jsp
validate=true
forward
name=continue
path=/pages/principal.jsp/
forward
name=erro
path=/login.jsp/
/action

In the validation.xml I have this:

form-validation
formset
form name=loginForm
field property=txtLogin
depends=required
arg0 key=login.display/
/field
field property=pwdSenha
depends=required
arg0 key=senha.display/
/field
/form
/formset   
/form-validation

Why the fields are not checked??


-
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: validation problem

2004-01-16 Thread Kelly Goedert
Yes I did. It is exactly like your application.

Matthias Wessendorf wrote:

hi kelly,

did you integrate it into
struts-config?
--

plug-in
className=org.apache.struts.validator.ValidatorPlugIn
set-property
property=pathnames

value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/
/plug-in
greetings

-Original Message-
From: Kelly Goedert [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 16, 2004 11:25 AM
To: Struts Users Mailing List
Subject: validation problem

Hi,

I'm trying to use the validator in a form that is used in as login form 
for authentication.
And the fields are not being checked.

I have this mapping on struts-config.xml

!-- Form Bean Definitions --
   form-beans
   form-bean name=loginForm 
type=org.apache.struts.validator.DynaValidatorForm
   form-property name=txtLogin type=java.lang.String/
   form-property name=pwdSenha type=java.lang.String/
   /form-bean
   /form-beans

   action path=/login
   type=LoginAction
   name = loginForm
   scope=request
   input=/login.jsp
   validate=true
   forward
   name=continue
   path=/pages/principal.jsp/
   forward
   name=erro
   path=/login.jsp/
   /action
In the validation.xml I have this:

form-validation
   formset
   form name=loginForm
   field property=txtLogin
   depends=required
   arg0 key=login.display/
   /field
   field property=pwdSenha
   depends=required
   arg0 key=senha.display/
   /field
   /form
   /formset   
/form-validation

Why the fields are not checked??

-
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]
 



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


RE: validation problem

2004-01-16 Thread Matthias Wessendorf
what is about

name=loginForm

instead:
name = loginForm
(as action.-attribute)?

but can´t be... ?!?



-Original Message-
From: Kelly Goedert [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 16, 2004 11:41 AM
To: Struts Users Mailing List
Subject: Re: validation problem


Yes I did. It is exactly like your application.

Matthias Wessendorf wrote:

hi kelly,

did you integrate it into
struts-config?

--

   plug-in
className=org.apache.struts.validator.ValidatorPlugIn
   set-property
   property=pathnames
   
value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/
   /plug-in

greetings

-Original Message-
From: Kelly Goedert [mailto:[EMAIL PROTECTED]
Sent: Friday, January 16, 2004 11:25 AM
To: Struts Users Mailing List
Subject: validation problem


Hi,

I'm trying to use the validator in a form that is used in as login form
for authentication.
And the fields are not being checked.

I have this mapping on struts-config.xml

!-- Form Bean Definitions --
form-beans
form-bean name=loginForm
type=org.apache.struts.validator.DynaValidatorForm
form-property name=txtLogin type=java.lang.String/
form-property name=pwdSenha type=java.lang.String/
/form-bean
/form-beans

action path=/login
type=LoginAction
name = loginForm
scope=request
input=/login.jsp
validate=true
forward
name=continue
path=/pages/principal.jsp/
forward
name=erro
path=/login.jsp/
/action

In the validation.xml I have this:

form-validation
formset
form name=loginForm
field property=txtLogin
depends=required
arg0 key=login.display/
/field
field property=pwdSenha
depends=required
arg0 key=senha.display/
/field
/form
/formset   
/form-validation

Why the fields are not checked??


-
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]

  




-
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: validation problem

2004-01-16 Thread Kelly Goedert
I'm sorry, I didn't get what you mean... could you explain?

Matthias Wessendorf wrote:

what is about

name=loginForm

instead:
name = loginForm
(as action.-attribute)?
but can´t be... ?!?



-Original Message-
From: Kelly Goedert [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 16, 2004 11:41 AM
To: Struts Users Mailing List
Subject: Re: validation problem

Yes I did. It is exactly like your application.

Matthias Wessendorf wrote:

 

hi kelly,

did you integrate it into
struts-config?
--

	plug-in
   

className=org.apache.struts.validator.ValidatorPlugIn
 

set-property
property=pathnames

value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/
/plug-in
greetings

-Original Message-
From: Kelly Goedert [mailto:[EMAIL PROTECTED]
Sent: Friday, January 16, 2004 11:25 AM
To: Struts Users Mailing List
Subject: validation problem
Hi,

I'm trying to use the validator in a form that is used in as login form
for authentication.
And the fields are not being checked.
I have this mapping on struts-config.xml

!-- Form Bean Definitions --
  form-beans
  form-bean name=loginForm
type=org.apache.struts.validator.DynaValidatorForm
  form-property name=txtLogin type=java.lang.String/
  form-property name=pwdSenha type=java.lang.String/
  /form-bean
  /form-beans
  action path=/login
  type=LoginAction
  name = loginForm
  scope=request
  input=/login.jsp
  validate=true
  forward
  name=continue
  path=/pages/principal.jsp/
  forward
  name=erro
  path=/login.jsp/
  /action
In the validation.xml I have this:

form-validation
  formset
  form name=loginForm
  field property=txtLogin
  depends=required
  arg0 key=login.display/
  /field
  field property=pwdSenha
  depends=required
  arg0 key=senha.display/
  /field
  /form
  /formset   
/form-validation

Why the fields are not checked??

-
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]


   



-
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]
 



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


Re: validation problem

2004-01-16 Thread Eric C
Shouldn't your formbean type point to the actual class loginForm instead of
org.apache.struts.validator.DynaValidatorForm, which i believe should be
in the bean code (bean extends DynaValidatorForm) ?


- Original Message -
From: Kelly Goedert [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Friday, January 16, 2004 11:24 AM
Subject: validation problem


 Hi,

 I'm trying to use the validator in a form that is used in as login form
 for authentication.
 And the fields are not being checked.

 I have this mapping on struts-config.xml

 !-- Form Bean Definitions --
 form-beans
 form-bean name=loginForm
 type=org.apache.struts.validator.DynaValidatorForm
 form-property name=txtLogin type=java.lang.String/
 form-property name=pwdSenha type=java.lang.String/
 /form-bean
 /form-beans

 action path=/login
 type=LoginAction
 name = loginForm
 scope=request
 input=/login.jsp
 validate=true
 forward
 name=continue
 path=/pages/principal.jsp/
 forward
 name=erro
 path=/login.jsp/
 /action

 In the validation.xml I have this:

 form-validation
 formset
 form name=loginForm
 field property=txtLogin
 depends=required
 arg0 key=login.display/
 /field
 field property=pwdSenha
 depends=required
 arg0 key=senha.display/
 /field
 /form
 /formset
 /form-validation

 Why the fields are not checked??


 -
 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: validation problem

2004-01-16 Thread Matthias Wessendorf
mmm strange :-)

in your action
the is a blank
name = loginForm


try name=loginForm


okay you have DynaValidatorForm
not DynaValidatorActionForm
(it´s sometimes not clear (the differents)...)

and you have
formset
  form name=loginForm

and NOT! name=/login
(what is needed for DynaValodatorActionForm...




so please try to create an own bean
which extends DynaValidatorForm
and in its validator()
do some debug-output
(for seeing, validator-framework works...)


greetings

-Original Message-
From: Kelly Goedert [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 16, 2004 12:08 PM
To: Struts Users Mailing List
Subject: Re: validation problem


I'm sorry, I didn't get what you mean... could you explain?

Matthias Wessendorf wrote:

what is about

name=loginForm

instead:
name = loginForm
(as action.-attribute)?

but can´t be... ?!?



-Original Message-
From: Kelly Goedert [mailto:[EMAIL PROTECTED]
Sent: Friday, January 16, 2004 11:41 AM
To: Struts Users Mailing List
Subject: Re: validation problem


Yes I did. It is exactly like your application.

Matthias Wessendorf wrote:

  

hi kelly,

did you integrate it into
struts-config?

--

  plug-in


className=org.apache.struts.validator.ValidatorPlugIn
  

  set-property
  property=pathnames
  
value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/
  /plug-in

greetings

-Original Message-
From: Kelly Goedert [mailto:[EMAIL PROTECTED]
Sent: Friday, January 16, 2004 11:25 AM
To: Struts Users Mailing List
Subject: validation problem


Hi,

I'm trying to use the validator in a form that is used in as login 
form for authentication. And the fields are not being checked.

I have this mapping on struts-config.xml

!-- Form Bean Definitions --
   form-beans
   form-bean name=loginForm 
type=org.apache.struts.validator.DynaValidatorForm
   form-property name=txtLogin type=java.lang.String/
   form-property name=pwdSenha type=java.lang.String/
   /form-bean
   /form-beans

   action path=/login
   type=LoginAction
   name = loginForm
   scope=request
   input=/login.jsp
   validate=true
   forward
   name=continue
   path=/pages/principal.jsp/
   forward
   name=erro
   path=/login.jsp/
   /action

In the validation.xml I have this:

form-validation
   formset
   form name=loginForm
   field property=txtLogin
   depends=required
   arg0 key=login.display/
   /field
   field property=pwdSenha
   depends=required
   arg0 key=senha.display/
   /field
   /form
   /formset   
/form-validation

Why the fields are not checked??


-
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]

 






-
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]


  




-
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: Validation: Problem with datePattern and JavaScript

2003-12-11 Thread Rouven Gehm
Well yes this quick fix work, i have added the following :

var datePattern = oDate[x][2](datePatternStrict);
if(datePattern == null) {

datePattern = oDate[x][2](datePattern);

}

But the main problem is, the javascript code, afterwards still needs a

strict input (e.g. 01.06.2000)  and not checks if a not so strict

pattern (e.g. 1.6.2000) is a valid date.

So either someone already has coded the javascript, or else i'll do it


Thanx

Rouven


From: Andy Schmidgall [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Wednesday, December 10, 2003 7:15 PM
Subject: RE: Validation: Problem with datePattern and JavaScript


It looks like the following line of code (in the date validator rule in
validator-rules.xml) loads the pattern:

var datePattern = oDate[x][2](datePatternStrict);

As far as I can tell, nothing is ever loaded for plain datePattern,
and this matches up with my experiences of using datePattern (i.e.
datePattern doesn't do any validation at all)

I haven't tried this, but it should probably be an easy fix to check if
oDate[x][2](datePattern) has a value and load that into datePattern.

-Andy


-Original Message-
From: Zakaria khabot [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 10, 2002 12:00 PM
To: Struts Users Mailing List
Subject: Re: Validation: Problem with datePattern and JavaScript


Hi,
Do u have an example of using validate-rules.xml in a JSP file.
Thanks

- Original Message - 
From: Rouven Gehm [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, December 04, 2003 1:53 PM
Subject: Validation: Problem with datePattern and JavaScript


 I want to know if someone has updated the javascript code
 in the validate-rules.xml, for the datePattern option ? Because the 
 code i have from the Struts 1.1 zip only work with datePatternStrict 
 !!!
 
 I have searched the user mailing list, for this problem, but not found

 any solution.
 
 Thanx
 
 Rouven
 
 -
 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]


-
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: Validation: Problem with datePattern and JavaScript

2003-12-10 Thread Zakaria khabot
Hi,
Do u have an example of using validate-rules.xml in a JSP file.
Thanks

- Original Message - 
From: Rouven Gehm [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, December 04, 2003 1:53 PM
Subject: Validation: Problem with datePattern and JavaScript


 I want to know if someone has updated the javascript code
 in the validate-rules.xml, for the datePattern option ?
 Because the code i have from the Struts 1.1 zip only
 work with datePatternStrict !!!
 
 I have searched the user mailing list, for this problem, but
 not found any solution.
 
 Thanx
 
 Rouven
 
 -
 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: Validation: Problem with datePattern and JavaScript

2003-12-10 Thread Andy Schmidgall
It looks like the following line of code (in the date validator rule in
validator-rules.xml) loads the pattern:

var datePattern = oDate[x][2](datePatternStrict);

As far as I can tell, nothing is ever loaded for plain datePattern,
and this matches up with my experiences of using datePattern (i.e.
datePattern doesn't do any validation at all)

I haven't tried this, but it should probably be an easy fix to check if
oDate[x][2](datePattern) has a value and load that into datePattern.

-Andy


-Original Message-
From: Zakaria khabot [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 10, 2002 12:00 PM
To: Struts Users Mailing List
Subject: Re: Validation: Problem with datePattern and JavaScript


Hi,
Do u have an example of using validate-rules.xml in a JSP file.
Thanks

- Original Message - 
From: Rouven Gehm [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, December 04, 2003 1:53 PM
Subject: Validation: Problem with datePattern and JavaScript


 I want to know if someone has updated the javascript code
 in the validate-rules.xml, for the datePattern option ? Because the 
 code i have from the Struts 1.1 zip only work with datePatternStrict 
 !!!
 
 I have searched the user mailing list, for this problem, but not found

 any solution.
 
 Thanx
 
 Rouven
 
 -
 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]


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



Re: validation problem

2003-06-17 Thread salgado . pc
Check in your validation.xml if the messages (arg0, in this case) that are
binded with your error message is correct...
maybe it always returns the same error... (have you checked filling other form
fields and checking if messages change)?

Without the xml validation rule it is the best i can do... hope it works.

Pedro Salgado




 Internet Mail Message  
 Received from host:  daedalus.apache.org   
 [208.185.179.12]   



From: Aleksandar Matijaca [EMAIL PROTECTED] on 16-06-2003 23:35
   
  Aleksandar Matijaca   To:   [EMAIL PROTECTED]   
 [EMAIL PROTECTED]   Cc:(bcc: Pedroemanuel Salgado-PC/PGI)  
Subject:  validation problem   
   
 17-06-2003 00:35  
  Please respond to Struts Users  
Mailing List  
 [EMAIL PROTECTED]  
   






Hi there,

this is my first post!  I have inherited a web-based struts
project that is frankly a mess...  I have managed to straighten
out most things except something that is driving me nuts - this
is the problem:

Validation - I have 3 fields that need to be validated - if I do not
enter anything on all three fields, validation happens - I display
the messages in the JSP using the logic:messagesPresent 'loop'.
However, the problem occurs if I fill in one of the fields, it
STILL reports that the first field is in error (the other two
which are unfilled are in error alos - this is a good thing), even though
there is
a value there (the validation is simple 'required').  If I fill in
ALL THREE FIELDS, then validation is OK, and I go on to the next
page.  There seems to be almost some kind of a caching of errors
that is happening, and I don't know how to turn it off.

Thanks Alex.


-
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: validation problem

2003-06-16 Thread David Graham
Post the relevant section of your validation xml file and more info about 
your form.

David


Hi there,

this is my first post!  I have inherited a web-based struts
project that is frankly a mess...  I have managed to straighten
out most things except something that is driving me nuts - this
is the problem:
Validation - I have 3 fields that need to be validated - if I do not
enter anything on all three fields, validation happens - I display
the messages in the JSP using the logic:messagesPresent 'loop'.
However, the problem occurs if I fill in one of the fields, it
STILL reports that the first field is in error (the other two
which are unfilled are in error alos - this is a good thing), even though
there is
a value there (the validation is simple 'required').  If I fill in
ALL THREE FIELDS, then validation is OK, and I go on to the next
page.  There seems to be almost some kind of a caching of errors
that is happening, and I don't know how to turn it off.
Thanks Alex.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


Re: validation problem

2003-06-16 Thread Aleksandar Matijaca
Well, this is what I inherited:


  formname=/public/EventRegistration

 fieldpage=1 property=registrant.firstname
   depends=required,mask,minlength,maxlength
 arg0 key=eForm.firstname/
 arg1 name=minlength key=${var:minlength}
resource=false/
 arg2 name=maxlength key=${var:maxlength}
resource=false/

 var
   var-namemask/var-name
   var-value^[a-zA-Z]*$/var-value
 /var
 var
   var-nameminlength/var-name
   var-value2/var-value
 /var
 var
   var-namemaxlength/var-name
   var-value40/var-value
 /var

 /field

 fieldpage=1 property=registrant.lastname
   depends=required,mask,minlength,maxlength
 arg0 key=eForm.lastname/
 arg1 name=minlength key=${var:minlength}
resource=false/
 arg2 name=maxlength key=${var:maxlength}
resource=false/
 var
   var-namemask/var-name
   var-value^[a-zA-Z]*$/var-value
 /var
 var
   var-nameminlength/var-name
   var-value2/var-value
 /var
 var
   var-namemaxlength/var-name
   var-value40/var-value
 /var

 /field


 fieldpage=1 property=registrant.companyname
   depends=required,minlength,maxlength
 arg0 key=eForm.companyname/
 arg1 name=minlength key=${var:minlength}
resource=false/
 arg2 name=maxlength key=${var:maxlength}
resource=false/
 var
   var-nameminlength/var-name
   var-value1/var-value
 /var
 var
   var-namemaxlength/var-name
   var-value40/var-value
 /var

 /field

/form





The form-bean is:


form-bean   name=eventRegistrationForm

type=ontario.exports.events.struts.EventRegistrationForm
/form-bean




The EventRegistrationForm extends EventDetailsForm which in-turn
extends - ValidatorBaseForm

These classes appear extremely messy and very long...

Thanks, Alex.



On Mon, 16 Jun 2003, David Graham wrote:

 Post the relevant section of your validation xml file and more info about
 your form.

 David


 
 Hi there,
 
 this is my first post!  I have inherited a web-based struts
 project that is frankly a mess...  I have managed to straighten
 out most things except something that is driving me nuts - this
 is the problem:
 
 Validation - I have 3 fields that need to be validated - if I do not
 enter anything on all three fields, validation happens - I display
 the messages in the JSP using the logic:messagesPresent 'loop'.
 However, the problem occurs if I fill in one of the fields, it
 STILL reports that the first field is in error (the other two
 which are unfilled are in error alos - this is a good thing), even though
 there is
 a value there (the validation is simple 'required').  If I fill in
 ALL THREE FIELDS, then validation is OK, and I go on to the next
 page.  There seems to be almost some kind of a caching of errors
 that is happening, and I don't know how to turn it off.
 
 Thanks Alex.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

 _
 Help STOP SPAM with the new MSN 8 and get 2 months FREE*
 http://join.msn.com/?page=features/junkmail


 -
 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]



ValidatorBaseForm - Re: validation problem

2003-06-16 Thread Aleksandar Matijaca


The ValidatorBaseForm simply extends ValidatorActionForm - sorry I fergot
to add that...



On Mon, 16 Jun 2003, Aleksandar Matijaca wrote:

 Well, this is what I inherited:


   formname=/public/EventRegistration

fieldpage=1 property=registrant.firstname
  depends=required,mask,minlength,maxlength
arg0 key=eForm.firstname/
arg1 name=minlength key=${var:minlength}
 resource=false/
arg2 name=maxlength key=${var:maxlength}
 resource=false/

  var
var-namemask/var-name
var-value^[a-zA-Z]*$/var-value
  /var
  var
var-nameminlength/var-name
var-value2/var-value
  /var
  var
var-namemaxlength/var-name
var-value40/var-value
  /var

  /field

  fieldpage=1 property=registrant.lastname
  depends=required,mask,minlength,maxlength
arg0 key=eForm.lastname/
arg1 name=minlength key=${var:minlength}
 resource=false/
arg2 name=maxlength key=${var:maxlength}
 resource=false/
  var
var-namemask/var-name
var-value^[a-zA-Z]*$/var-value
  /var
  var
var-nameminlength/var-name
var-value2/var-value
  /var
  var
var-namemaxlength/var-name
var-value40/var-value
  /var

  /field


  fieldpage=1 property=registrant.companyname
  depends=required,minlength,maxlength
arg0 key=eForm.companyname/
arg1 name=minlength key=${var:minlength}
 resource=false/
arg2 name=maxlength key=${var:maxlength}
 resource=false/
  var
var-nameminlength/var-name
var-value1/var-value
  /var
  var
var-namemaxlength/var-name
var-value40/var-value
  /var

  /field

   /form



 

 The form-bean is:


 form-bean   name=eventRegistrationForm

 type=ontario.exports.events.struts.EventRegistrationForm
 /form-bean

 


 The EventRegistrationForm extends EventDetailsForm which in-turn
 extends - ValidatorBaseForm

 These classes appear extremely messy and very long...

 Thanks, Alex.



 On Mon, 16 Jun 2003, David Graham wrote:

  Post the relevant section of your validation xml file and more info about
  your form.
 
  David
 
 
  
  Hi there,
  
  this is my first post!  I have inherited a web-based struts
  project that is frankly a mess...  I have managed to straighten
  out most things except something that is driving me nuts - this
  is the problem:
  
  Validation - I have 3 fields that need to be validated - if I do not
  enter anything on all three fields, validation happens - I display
  the messages in the JSP using the logic:messagesPresent 'loop'.
  However, the problem occurs if I fill in one of the fields, it
  STILL reports that the first field is in error (the other two
  which are unfilled are in error alos - this is a good thing), even though
  there is
  a value there (the validation is simple 'required').  If I fill in
  ALL THREE FIELDS, then validation is OK, and I go on to the next
  page.  There seems to be almost some kind of a caching of errors
  that is happening, and I don't know how to turn it off.
  
  Thanks Alex.
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
 
  _
  Help STOP SPAM with the new MSN 8 and get 2 months FREE*
  http://join.msn.com/?page=features/junkmail
 
 
  -
  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]


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



Re: validation problem

2003-06-16 Thread David Graham
I believe the form name must be the same as what you defined in 
struts-config.xml.  Try
form name=eventRegistrationForm in your validation rules.

David

Well, this is what I inherited:

  formname=/public/EventRegistration

 fieldpage=1 property=registrant.firstname
   depends=required,mask,minlength,maxlength
 arg0 key=eForm.firstname/
 arg1 name=minlength key=${var:minlength}
resource=false/
 arg2 name=maxlength key=${var:maxlength}
resource=false/
 var
   var-namemask/var-name
   var-value^[a-zA-Z]*$/var-value
 /var
 var
   var-nameminlength/var-name
   var-value2/var-value
 /var
 var
   var-namemaxlength/var-name
   var-value40/var-value
 /var
 /field

 fieldpage=1 property=registrant.lastname
   depends=required,mask,minlength,maxlength
 arg0 key=eForm.lastname/
 arg1 name=minlength key=${var:minlength}
resource=false/
 arg2 name=maxlength key=${var:maxlength}
resource=false/
 var
   var-namemask/var-name
   var-value^[a-zA-Z]*$/var-value
 /var
 var
   var-nameminlength/var-name
   var-value2/var-value
 /var
 var
   var-namemaxlength/var-name
   var-value40/var-value
 /var
 /field

 fieldpage=1 property=registrant.companyname
   depends=required,minlength,maxlength
 arg0 key=eForm.companyname/
 arg1 name=minlength key=${var:minlength}
resource=false/
 arg2 name=maxlength key=${var:maxlength}
resource=false/
 var
   var-nameminlength/var-name
   var-value1/var-value
 /var
 var
   var-namemaxlength/var-name
   var-value40/var-value
 /var
 /field

	/form





The form-bean is:

form-bean   name=eventRegistrationForm

type=ontario.exports.events.struts.EventRegistrationForm
/form-bean


The EventRegistrationForm extends EventDetailsForm which in-turn
extends - ValidatorBaseForm
These classes appear extremely messy and very long...

Thanks, Alex.



On Mon, 16 Jun 2003, David Graham wrote:

 Post the relevant section of your validation xml file and more info 
about
 your form.

 David


 
 Hi there,
 
 this is my first post!  I have inherited a web-based struts
 project that is frankly a mess...  I have managed to straighten
 out most things except something that is driving me nuts - this
 is the problem:
 
 Validation - I have 3 fields that need to be validated - if I do not
 enter anything on all three fields, validation happens - I display
 the messages in the JSP using the logic:messagesPresent 'loop'.
 However, the problem occurs if I fill in one of the fields, it
 STILL reports that the first field is in error (the other two
 which are unfilled are in error alos - this is a good thing), even 
though
 there is
 a value there (the validation is simple 'required').  If I fill in
 ALL THREE FIELDS, then validation is OK, and I go on to the next
 page.  There seems to be almost some kind of a caching of errors
 that is happening, and I don't know how to turn it off.
 
 Thanks Alex.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

 _
 Help STOP SPAM with the new MSN 8 and get 2 months FREE*
 http://join.msn.com/?page=features/junkmail


 -
 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]
_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


Re: ValidatorBaseForm - Re: validation problem

2003-06-16 Thread David Graham
The ValidatorBaseForm simply extends ValidatorActionForm - sorry I fergot
to add that...
Oh, that might be why they used /public/EventRegistration as the form name.  
Try extending ValidatorForm and using the bean name defined in 
struts-config.xml instead.

David



On Mon, 16 Jun 2003, Aleksandar Matijaca wrote:

 Well, this is what I inherited:


   formname=/public/EventRegistration

 		 fieldpage=1 property=registrant.firstname
  	   depends=required,mask,minlength,maxlength
  	 arg0 key=eForm.firstname/
  	 arg1 name=minlength key=${var:minlength}
 resource=false/
  	 arg2 name=maxlength key=${var:maxlength}
 resource=false/

  var
var-namemask/var-name
var-value^[a-zA-Z]*$/var-value
  /var
  var
var-nameminlength/var-name
var-value2/var-value
  /var
  var
var-namemaxlength/var-name
var-value40/var-value
  /var

  /field

  fieldpage=1 property=registrant.lastname
  	   depends=required,mask,minlength,maxlength
  	 arg0 key=eForm.lastname/
  	 arg1 name=minlength key=${var:minlength}
 resource=false/
  	 arg2 name=maxlength key=${var:maxlength}
 resource=false/
  var
var-namemask/var-name
var-value^[a-zA-Z]*$/var-value
  /var
  var
var-nameminlength/var-name
var-value2/var-value
  /var
  var
var-namemaxlength/var-name
var-value40/var-value
  /var

  /field


  fieldpage=1 property=registrant.companyname
  	   depends=required,minlength,maxlength
  	 arg0 key=eForm.companyname/
  	 arg1 name=minlength key=${var:minlength}
 resource=false/
  	 arg2 name=maxlength key=${var:maxlength}
 resource=false/
  var
var-nameminlength/var-name
var-value1/var-value
  /var
  var
var-namemaxlength/var-name
var-value40/var-value
  /var

  /field

 	/form



 

 The form-bean is:


 form-bean   name=eventRegistrationForm

 type=ontario.exports.events.struts.EventRegistrationForm
 /form-bean

 


 The EventRegistrationForm extends EventDetailsForm which in-turn
 extends - ValidatorBaseForm

 These classes appear extremely messy and very long...

 Thanks, Alex.



 On Mon, 16 Jun 2003, David Graham wrote:

  Post the relevant section of your validation xml file and more info 
about
  your form.
 
  David
 
 
  
  Hi there,
  
  this is my first post!  I have inherited a web-based struts
  project that is frankly a mess...  I have managed to straighten
  out most things except something that is driving me nuts - this
  is the problem:
  
  Validation - I have 3 fields that need to be validated - if I do not
  enter anything on all three fields, validation happens - I display
  the messages in the JSP using the logic:messagesPresent 'loop'.
  However, the problem occurs if I fill in one of the fields, it
  STILL reports that the first field is in error (the other two
  which are unfilled are in error alos - this is a good thing), even 
though
  there is
  a value there (the validation is simple 'required').  If I fill in
  ALL THREE FIELDS, then validation is OK, and I go on to the next
  page.  There seems to be almost some kind of a caching of errors
  that is happening, and I don't know how to turn it off.
  
  Thanks Alex.
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
 
  _
  Help STOP SPAM with the new MSN 8 and get 2 months FREE*
  http://join.msn.com/?page=features/junkmail
 
 
  -
  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]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
Protect your PC - get McAfee.com 

RE: Validation Problem

2003-06-09 Thread Bailey, Shane C.

I didn't notice if you got your problem solved but it is a simple spelling
error:

   public void setField1(String feld1)
   {
this.field1 = field1;
   }

should be:

setField1(String field1)



-Original Message-
From: Thomas Miskiewicz [mailto:[EMAIL PROTECTED] 
Sent: Sunday, June 08, 2003 4:47 PM
To: Struts Users Mailing List
Subject: Validation Problem

Hi!

I now have a strange validation problem. I use this ActionForm class:

package com.mycompany;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.util.MessageResources;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import java.lang.String;

public class PostTestForm extends ActionForm
{
   private String field1 = ;
   private String field2 = ;
   private String field3 = ;

   private void checkForEmpty(String fieldName, String fieldKey, String
value,
  ActionErrors errors)
   {
if (value.trim().length() == 0)
{
 System.out.println(fieldName + value.trim().length());
 ActionError error = new ActionError(error.posttest.field.null,
fieldName);
 errors.add(fieldKey, error);
}
   }

   private void checkForLength(String fieldName, String fieldKey, String
value,
   int maxLength, ActionErrors errors)
   {
if (value.length()  maxLength)
{
 ActionError error =  new ActionError(error.posttest.field.length,
fieldName);
 System.out.println(maxLength);
 errors.add(fieldKey, error);
}
   }


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

checkForEmpty(field1, error.field1.empty, getField1(), errors);
checkForEmpty(field2, error.field2.empty, getField2(), errors);
checkForEmpty(field3, error.field3.empty, getField3(), errors);

checkForLength(field1, error.field1.length, getField1(), 5, errors);
checkForLength(field2, error.field2.length, getField2(), 5, errors);
checkForLength(field3, error.field3.length, getField3(), 5, errors);

return errors;
   }

   public void reset(ActionMapping mapping, HttpServletRequest request)
   {
field1 = ;
field2 = ;
field3 = ;
   }

   public String getField1()
   {
return field1;
   }

   public void setField1(String feld1)
   {
this.field1 = field1;
   }

   public String getField2()
   {
return field2;
   }

   public void setField2(String field2)
   {
this.field2 = field2;
   }

   public String getField3()
   {
return field3;
   }

   public void setField3(String field3)
   {
this.field3 = field3;
   }

}

Everything works fine except the application always claims, that field1 is
empty
even if it's not. value.trim().length() always is = 0 with respect to the
field1.
The content of the HTML-Form looks like this:

%@ page language=java %
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %
%@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic %
%@ taglib uri=/WEB-INF/struts-template.tld prefix=template %
html:form action=postTest
table border=0 cellpadding=0 cellspacing=0
style=border-collapse:collapse bgcolor=E7E7E7 width=100%
height=900px
tr
  td
html:errors/
  /td
/tr
tr
  td
input name=field1 type=text size=17 maxlength=32
  /td
/tr
tr
  td
input name=field2 type=text size=17 maxlength=32
  /td
/tr
tr
  td
input name=field3 type=text size=17 maxlength=32
  /td
/tr
tr
  td
input name=submit type=submit value=Submit
  /td
/tr
/table
/html:form

What's wrong???

Regards
Tom


-
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: Validation Problem

2003-06-08 Thread David Graham
Well, these validations have already been coded for you and can be 
configured in an xml file by using the Validator.  I highly recommend you 
look into using the validator because it will save you a bunch of time.

Your problem may have something to do with setting the fields =  in reset. 
 I would put a stdout call in reset to see when it gets called.  If your 
forms are stored in the request (and I maybe even in the session) then you 
don't need to implement the reset method at all.  It's really only needed to 
reset boolean properties.

David


From: Thomas Miskiewicz [EMAIL PROTECTED]
Reply-To: Thomas Miskiewicz [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: Validation Problem
Date: Sun, 8 Jun 2003 22:47:25 +0200
Hi!

I now have a strange validation problem. I use this ActionForm class:

package com.mycompany;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.util.MessageResources;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.lang.String;

public class PostTestForm extends ActionForm
{
   private String field1 = ;
   private String field2 = ;
   private String field3 = ;
   private void checkForEmpty(String fieldName, String fieldKey, String
value,
  ActionErrors errors)
   {
if (value.trim().length() == 0)
{
 System.out.println(fieldName + value.trim().length());
 ActionError error = new ActionError(error.posttest.field.null,
fieldName);
 errors.add(fieldKey, error);
}
   }
   private void checkForLength(String fieldName, String fieldKey, String
value,
   int maxLength, ActionErrors errors)
   {
if (value.length()  maxLength)
{
 ActionError error =  new ActionError(error.posttest.field.length,
fieldName);
 System.out.println(maxLength);
 errors.add(fieldKey, error);
}
   }
   public ActionErrors validate(ActionMapping mapping,
 HttpServletRequest request)
   {
ActionErrors errors = new ActionErrors();
checkForEmpty(field1, error.field1.empty, getField1(), errors);
checkForEmpty(field2, error.field2.empty, getField2(), errors);
checkForEmpty(field3, error.field3.empty, getField3(), errors);
checkForLength(field1, error.field1.length, getField1(), 5, 
errors);
checkForLength(field2, error.field2.length, getField2(), 5, 
errors);
checkForLength(field3, error.field3.length, getField3(), 5, 
errors);

return errors;
   }
   public void reset(ActionMapping mapping, HttpServletRequest request)
   {
field1 = ;
field2 = ;
field3 = ;
   }
   public String getField1()
   {
return field1;
   }
   public void setField1(String feld1)
   {
this.field1 = field1;
   }
   public String getField2()
   {
return field2;
   }
   public void setField2(String field2)
   {
this.field2 = field2;
   }
   public String getField3()
   {
return field3;
   }
   public void setField3(String field3)
   {
this.field3 = field3;
   }
}

Everything works fine except the application always claims, that field1 is
empty
even if it's not. value.trim().length() always is = 0 with respect to the
field1.
The content of the HTML-Form looks like this:
%@ page language=java %
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %
%@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic %
%@ taglib uri=/WEB-INF/struts-template.tld prefix=template %
html:form action=postTest
table border=0 cellpadding=0 cellspacing=0
style=border-collapse:collapse bgcolor=E7E7E7 width=100%
height=900px
tr
  td
html:errors/
  /td
/tr
tr
  td
input name=field1 type=text size=17 maxlength=32
  /td
/tr
tr
  td
input name=field2 type=text size=17 maxlength=32
  /td
/tr
tr
  td
input name=field3 type=text size=17 maxlength=32
  /td
/tr
tr
  td
input name=submit type=submit value=Submit
  /td
/tr
/table
/html:form
What's wrong???

Regards
Tom
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


Re: Validation Problem

2003-06-08 Thread Thomas Miskiewicz
David,

 Well, these validations have already been coded for you and can be
 configured in an xml file by using the Validator.  I highly recommend you
 look into using the validator because it will save you a bunch of time.

I'll do soon. I getting acquainted with Struts working with the book
Professional Struts Applications. I still have 14 pages ahead the validator
framework. But before I jump to it, I'd like to understand why some
basics don't work to gain more confidence in the whole framework.

 Your problem may have something to do with setting the fields =  in
reset.
  I would put a stdout call in reset to see when it gets called.
I did that and reset gets called.

 If your forms are stored in the request (and I maybe even in the session)
then you
 don't need to implement the reset method at all.
They're being stored in the request. But wait a second. Why do you mean I
don't
need to implement the reset method? The guy in the book states:

The reset() method is invoked only if the developer has declared that the
ActionForm
class should be stored in the request. This is necessary because Struts
maintains a cache
for each of the ActionForm classes. A single instance of an ActionForm class
can be
shared by multiple users for different reqests at different times. Hence,
the developer must
implement the reset() method to ensure that the end user never gets some
other user's
data

How does this sound?

 It's really only needed to reset boolean properties.
He doesn't mention that...

Tom


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



Re: Validation Problem

2003-06-08 Thread Marco Tedone
Why don't you use html:text?

Marco
- Original Message - 
From: Thomas Miskiewicz [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Sunday, June 08, 2003 9:47 PM
Subject: Validation Problem


 Hi!

 I now have a strange validation problem. I use this ActionForm class:

 package com.mycompany;

 import org.apache.struts.action.Action;
 import org.apache.struts.action.ActionMapping;
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionForward;
 import org.apache.struts.action.ActionErrors;
 import org.apache.struts.action.ActionError;
 import org.apache.struts.action.ActionServlet;
 import org.apache.struts.util.MessageResources;

 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;

 import java.lang.String;

 public class PostTestForm extends ActionForm
 {
private String field1 = ;
private String field2 = ;
private String field3 = ;

private void checkForEmpty(String fieldName, String fieldKey, String
 value,
   ActionErrors errors)
{
 if (value.trim().length() == 0)
 {
  System.out.println(fieldName + value.trim().length());
  ActionError error = new ActionError(error.posttest.field.null,
 fieldName);
  errors.add(fieldKey, error);
 }
}

private void checkForLength(String fieldName, String fieldKey, String
 value,
int maxLength, ActionErrors errors)
{
 if (value.length()  maxLength)
 {
  ActionError error =  new ActionError(error.posttest.field.length,
 fieldName);
  System.out.println(maxLength);
  errors.add(fieldKey, error);
 }
}


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

 checkForEmpty(field1, error.field1.empty, getField1(), errors);
 checkForEmpty(field2, error.field2.empty, getField2(), errors);
 checkForEmpty(field3, error.field3.empty, getField3(), errors);

 checkForLength(field1, error.field1.length, getField1(), 5,
errors);
 checkForLength(field2, error.field2.length, getField2(), 5,
errors);
 checkForLength(field3, error.field3.length, getField3(), 5,
errors);

 return errors;
}

public void reset(ActionMapping mapping, HttpServletRequest request)
{
 field1 = ;
 field2 = ;
 field3 = ;
}

public String getField1()
{
 return field1;
}

public void setField1(String feld1)
{
 this.field1 = field1;
}

public String getField2()
{
 return field2;
}

public void setField2(String field2)
{
 this.field2 = field2;
}

public String getField3()
{
 return field3;
}

public void setField3(String field3)
{
 this.field3 = field3;
}

 }

 Everything works fine except the application always claims, that field1 is
 empty
 even if it's not. value.trim().length() always is = 0 with respect to the
 field1.
 The content of the HTML-Form looks like this:

 %@ page language=java %
 %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
 %@ taglib uri=/WEB-INF/struts-html.tld prefix=html %
 %@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic %
 %@ taglib uri=/WEB-INF/struts-template.tld prefix=template %
 html:form action=postTest
 table border=0 cellpadding=0 cellspacing=0
 style=border-collapse:collapse bgcolor=E7E7E7 width=100%
 height=900px
 tr
   td
 html:errors/
   /td
 /tr
 tr
   td
 input name=field1 type=text size=17 maxlength=32
   /td
 /tr
 tr
   td
 input name=field2 type=text size=17 maxlength=32
   /td
 /tr
 tr
   td
 input name=field3 type=text size=17 maxlength=32
   /td
 /tr
 tr
   td
 input name=submit type=submit value=Submit
   /td
 /tr
 /table
 /html:form

 What's wrong???

 Regards
 Tom


 -
 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: Validation Problem

2003-06-08 Thread David Graham
The author is incorrect.  Check out 
http://jakarta.apache.org/struts/faqs/newbie.html#reset for more info.

David

 Well, these validations have already been coded for you and can be
 configured in an xml file by using the Validator.  I highly recommend 
you
 look into using the validator because it will save you a bunch of time.

I'll do soon. I getting acquainted with Struts working with the book
Professional Struts Applications. I still have 14 pages ahead the validator
framework. But before I jump to it, I'd like to understand why some
basics don't work to gain more confidence in the whole framework.
 Your problem may have something to do with setting the fields =  in
reset.
  I would put a stdout call in reset to see when it gets called.
I did that and reset gets called.
 If your forms are stored in the request (and I maybe even in the 
session)
then you
 don't need to implement the reset method at all.
They're being stored in the request. But wait a second. Why do you mean I
don't
need to implement the reset method? The guy in the book states:

The reset() method is invoked only if the developer has declared that the
ActionForm
class should be stored in the request. This is necessary because Struts
maintains a cache
for each of the ActionForm classes. A single instance of an ActionForm 
class
can be
shared by multiple users for different reqests at different times. Hence,
the developer must
implement the reset() method to ensure that the end user never gets some
other user's
data

How does this sound?

 It's really only needed to reset boolean properties.
He doesn't mention that...
Tom

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_
The new MSN 8: advanced junk mail protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail

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


Re: Validation problem

2003-02-20 Thread alexj
have you try to restart tomcat ?

- Original Message -
From: Johan Kumps [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, February 20, 2003 10:02 PM
Subject: Validation problem


 Hi all,

 I have a problem displaying error messages. Why is my message not
displayed?
 Am I doing somthing wrong?

 Please help me, I'm loosing time with this one...

 Please consider following code :

 struts-config.xml :

 ...

 form-bean name='someForm' type='SomeForm' /
 ...
 action path='/something'
   type=SomeAction
   name=someForm
   scope=request
   validate=true
   input=/index.jsp
   parameter=get
   forward name=success path=/somethingelse.do /
 /action
 ...

 Form class :

 ...

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

 if(email == null || !checkEmail(email)) {
 errors.add(Action.ERROR_KEY, new
 ActionError(error.invalid.email));
 }
 return errors;
 }

 private boolean checkEmail (String email) {
 if ((email != null)  (email.trim().length() != 0)){
 String stukNaAt = null;
 if (email.indexOf(@) != -1){
 stukNaAt = email.substring(email.indexOf(@));
 } else {
 return false;
 }
 if ((email.indexOf(@) != email.lastIndexOf(@)) ||
 (email.indexOf( ) != -1) ||
 (stukNaAt.indexOf(.) == -1)
 (stukNaAt.indexOf(.) == stukNaAt.length() -1) ||
 (email.trim().charAt(email.trim().length()-1) =='.') ) {
 return false;
 }
 } else {
 return false;
 }
 return true;
 }

 ...

 ApplicationResources.properties in /WEB-INF/classes

 error.invalid.email=Please provide us with a valid e-mail address.

 JSP :

 html:errors/


 ---
 This mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003


 -
 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: Validation problem

2003-02-20 Thread Ian Hunter
When you add your error message to the errors object, you are specifying
Action.ERROR_KEY instead of ActionErrors.GLOBAL_ERROR -- so you'd have to do
something like

html:errors property=something/ to get that SPECIFIC error.  If you
switch to ActionErrors.GLOBAL_ERROR it will display all of them with just
html:errors/


- Original Message -
From: Johan Kumps [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, February 20, 2003 4:02 PM
Subject: Validation problem


 Hi all,

 I have a problem displaying error messages. Why is my message not
displayed?
 Am I doing somthing wrong?

 Please help me, I'm loosing time with this one...

 Please consider following code :

 Form class :

 ...

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

 if(email == null || !checkEmail(email)) {
 errors.add(Action.ERROR_KEY, new
 ActionError(error.invalid.email));
 }
 return errors;
 }


 JSP :

 html:errors/


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




RE: Validation problem

2003-02-20 Thread Johan Kumps
Thanks for your help.

My jsp is displaying : ???nl_BE.error.invalid.email???

Still something wrong. It seems my key is not found.

Can you help me again please?

Kind regards,

-Oorspronkelijk bericht-
Van: Ian Hunter [mailto:[EMAIL PROTECTED]]
Verzonden: donderdag 20 februari 2003 22:15
Aan: Struts Users Mailing List
Onderwerp: Re: Validation problem


When you add your error message to the errors object, you are specifying
Action.ERROR_KEY instead of ActionErrors.GLOBAL_ERROR -- so you'd have to do
something like

html:errors property=something/ to get that SPECIFIC error.  If you
switch to ActionErrors.GLOBAL_ERROR it will display all of them with just
html:errors/


- Original Message -
From: Johan Kumps [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, February 20, 2003 4:02 PM
Subject: Validation problem


 Hi all,

 I have a problem displaying error messages. Why is my message not
displayed?
 Am I doing somthing wrong?

 Please help me, I'm loosing time with this one...

 Please consider following code :

 Form class :

 ...

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

 if(email == null || !checkEmail(email)) {
 errors.add(Action.ERROR_KEY, new
 ActionError(error.invalid.email));
 }
 return errors;
 }


 JSP :

 html:errors/


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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003

---
This mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003


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




Re: Validation problem

2003-02-20 Thread Ian Hunter
Did you switch to ActionErrors.GLOBAL_KEY or change your JSP code?

1)  If you changed your JSP to html:errors property=ERROR_KEY/ or
something, keep this in mind: I use a class called Constants for each web
app and refer to Constants.LOGINERROR_KEY in my code, but I have to make
sure that my JSP has the correct text.  What is the name of the property/key
you're assigning the error to?

2)  If you shifted to ActionErrors.GLOBAL_KEY, are you sure your locale is
right and your Resource bundle has the appropriate text key?

Try throwing this code in your JSP:

logic:notPresent name=org.apache.struts.action.MESSAGE
scope=application
  font color=red
ERROR:  Language independent messages not loaded -- contact
administrator
for assistance.
  /font
/logic:notPresent


- Original Message -
From: Johan Kumps [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, February 20, 2003 4:25 PM
Subject: RE: Validation problem


 Thanks for your help.

 My jsp is displaying : ???nl_BE.error.invalid.email???

 Still something wrong. It seems my key is not found.

 Can you help me again please?

 Kind regards,

 -Oorspronkelijk bericht-
 Van: Ian Hunter [mailto:[EMAIL PROTECTED]]
 Verzonden: donderdag 20 februari 2003 22:15
 Aan: Struts Users Mailing List
 Onderwerp: Re: Validation problem


 When you add your error message to the errors object, you are specifying
 Action.ERROR_KEY instead of ActionErrors.GLOBAL_ERROR -- so you'd have to
do
 something like

 html:errors property=something/ to get that SPECIFIC error.  If you
 switch to ActionErrors.GLOBAL_ERROR it will display all of them with just
 html:errors/


 - Original Message -
 From: Johan Kumps [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Thursday, February 20, 2003 4:02 PM
 Subject: Validation problem


  Hi all,
 
  I have a problem displaying error messages. Why is my message not
 displayed?
  Am I doing somthing wrong?
 
  Please help me, I'm loosing time with this one...
 
  Please consider following code :
 
  Form class :
 
  ...
 
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest
  request) {
  ActionErrors errors = new ActionErrors();
 
  if(email == null || !checkEmail(email)) {
  errors.add(Action.ERROR_KEY, new
  ActionError(error.invalid.email));
  }
  return errors;
  }
 

  JSP :
 
  html:errors/


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


 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003

 ---
 This mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003


 -
 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: Validation problem

2003-02-20 Thread Johan Kumps
I implemented your second option.

-Oorspronkelijk bericht-
Van: Ian Hunter [mailto:[EMAIL PROTECTED]]
Verzonden: donderdag 20 februari 2003 22:35
Aan: Struts Users Mailing List
Onderwerp: Re: Validation problem


Did you switch to ActionErrors.GLOBAL_KEY or change your JSP code?

1)  If you changed your JSP to html:errors property=ERROR_KEY/ or
something, keep this in mind: I use a class called Constants for each web
app and refer to Constants.LOGINERROR_KEY in my code, but I have to make
sure that my JSP has the correct text.  What is the name of the property/key
you're assigning the error to?

2)  If you shifted to ActionErrors.GLOBAL_KEY, are you sure your locale is
right and your Resource bundle has the appropriate text key?

Try throwing this code in your JSP:

logic:notPresent name=org.apache.struts.action.MESSAGE
scope=application
  font color=red
ERROR:  Language independent messages not loaded -- contact
administrator
for assistance.
  /font
/logic:notPresent


- Original Message -
From: Johan Kumps [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, February 20, 2003 4:25 PM
Subject: RE: Validation problem


 Thanks for your help.

 My jsp is displaying : ???nl_BE.error.invalid.email???

 Still something wrong. It seems my key is not found.

 Can you help me again please?

 Kind regards,

 -Oorspronkelijk bericht-
 Van: Ian Hunter [mailto:[EMAIL PROTECTED]]
 Verzonden: donderdag 20 februari 2003 22:15
 Aan: Struts Users Mailing List
 Onderwerp: Re: Validation problem


 When you add your error message to the errors object, you are specifying
 Action.ERROR_KEY instead of ActionErrors.GLOBAL_ERROR -- so you'd have to
do
 something like

 html:errors property=something/ to get that SPECIFIC error.  If you
 switch to ActionErrors.GLOBAL_ERROR it will display all of them with just
 html:errors/


 - Original Message -
 From: Johan Kumps [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Thursday, February 20, 2003 4:02 PM
 Subject: Validation problem


  Hi all,
 
  I have a problem displaying error messages. Why is my message not
 displayed?
  Am I doing somthing wrong?
 
  Please help me, I'm loosing time with this one...
 
  Please consider following code :
 
  Form class :
 
  ...
 
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest
  request) {
  ActionErrors errors = new ActionErrors();
 
  if(email == null || !checkEmail(email)) {
  errors.add(Action.ERROR_KEY, new
  ActionError(error.invalid.email));
  }
  return errors;
  }
 

  JSP :
 
  html:errors/


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


 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003

 ---
 This mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003


 -
 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]


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003

---
This mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003


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




Re: Validation problem

2003-02-20 Thread Ian Hunter
Did the logic:notPresent tag cause your app to complain about not having
the resources loaded?

- Original Message -
From: Johan Kumps [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, February 20, 2003 4:51 PM
Subject: RE: Validation problem


 I implemented your second option.

 -Oorspronkelijk bericht-
 Van: Ian Hunter [mailto:[EMAIL PROTECTED]]
 Verzonden: donderdag 20 februari 2003 22:35
 Aan: Struts Users Mailing List
 Onderwerp: Re: Validation problem


 Did you switch to ActionErrors.GLOBAL_KEY or change your JSP code?

 1)  If you changed your JSP to html:errors property=ERROR_KEY/ or
 something, keep this in mind: I use a class called Constants for each
web
 app and refer to Constants.LOGINERROR_KEY in my code, but I have to make
 sure that my JSP has the correct text.  What is the name of the
property/key
 you're assigning the error to?

 2)  If you shifted to ActionErrors.GLOBAL_KEY, are you sure your locale is
 right and your Resource bundle has the appropriate text key?

 Try throwing this code in your JSP:

 logic:notPresent name=org.apache.struts.action.MESSAGE
 scope=application
   font color=red
 ERROR:  Language independent messages not loaded -- contact
 administrator
 for assistance.
   /font
 /logic:notPresent


 - Original Message -
 From: Johan Kumps [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Thursday, February 20, 2003 4:25 PM
 Subject: RE: Validation problem


  Thanks for your help.
 
  My jsp is displaying : ???nl_BE.error.invalid.email???
 
  Still something wrong. It seems my key is not found.
 
  Can you help me again please?
 
  Kind regards,
 
  -Oorspronkelijk bericht-
  Van: Ian Hunter [mailto:[EMAIL PROTECTED]]
  Verzonden: donderdag 20 februari 2003 22:15
  Aan: Struts Users Mailing List
  Onderwerp: Re: Validation problem
 
 
  When you add your error message to the errors object, you are specifying
  Action.ERROR_KEY instead of ActionErrors.GLOBAL_ERROR -- so you'd have
to
 do
  something like
 
  html:errors property=something/ to get that SPECIFIC error.  If you
  switch to ActionErrors.GLOBAL_ERROR it will display all of them with
just
  html:errors/
 
 
  - Original Message -
  From: Johan Kumps [EMAIL PROTECTED]
  To: Struts Users Mailing List [EMAIL PROTECTED]
  Sent: Thursday, February 20, 2003 4:02 PM
  Subject: Validation problem
 
 
   Hi all,
  
   I have a problem displaying error messages. Why is my message not
  displayed?
   Am I doing somthing wrong?
  
   Please help me, I'm loosing time with this one...
  
   Please consider following code :
  
   Form class :
  
   ...
  
   public ActionErrors validate(ActionMapping mapping, HttpServletRequest
   request) {
   ActionErrors errors = new ActionErrors();
  
   if(email == null || !checkEmail(email)) {
   errors.add(Action.ERROR_KEY, new
   ActionError(error.invalid.email));
   }
   return errors;
   }
  
 
   JSP :
  
   html:errors/
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
  ---
  Incoming mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003
 
  ---
  This mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003
 
 
  -
  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]


 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003

 ---
 This mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003


 -
 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: Validation problem

2003-02-20 Thread Johan Kumps
no app did not complain

-Oorspronkelijk bericht-
Van: Ian Hunter [mailto:[EMAIL PROTECTED]]
Verzonden: donderdag 20 februari 2003 22:55
Aan: Struts Users Mailing List
Onderwerp: Re: Validation problem


Did the logic:notPresent tag cause your app to complain about not having
the resources loaded?

- Original Message -
From: Johan Kumps [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, February 20, 2003 4:51 PM
Subject: RE: Validation problem


 I implemented your second option.

 -Oorspronkelijk bericht-
 Van: Ian Hunter [mailto:[EMAIL PROTECTED]]
 Verzonden: donderdag 20 februari 2003 22:35
 Aan: Struts Users Mailing List
 Onderwerp: Re: Validation problem


 Did you switch to ActionErrors.GLOBAL_KEY or change your JSP code?

 1)  If you changed your JSP to html:errors property=ERROR_KEY/ or
 something, keep this in mind: I use a class called Constants for each
web
 app and refer to Constants.LOGINERROR_KEY in my code, but I have to make
 sure that my JSP has the correct text.  What is the name of the
property/key
 you're assigning the error to?

 2)  If you shifted to ActionErrors.GLOBAL_KEY, are you sure your locale is
 right and your Resource bundle has the appropriate text key?

 Try throwing this code in your JSP:

 logic:notPresent name=org.apache.struts.action.MESSAGE
 scope=application
   font color=red
 ERROR:  Language independent messages not loaded -- contact
 administrator
 for assistance.
   /font
 /logic:notPresent


 - Original Message -
 From: Johan Kumps [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Thursday, February 20, 2003 4:25 PM
 Subject: RE: Validation problem


  Thanks for your help.
 
  My jsp is displaying : ???nl_BE.error.invalid.email???
 
  Still something wrong. It seems my key is not found.
 
  Can you help me again please?
 
  Kind regards,
 
  -Oorspronkelijk bericht-
  Van: Ian Hunter [mailto:[EMAIL PROTECTED]]
  Verzonden: donderdag 20 februari 2003 22:15
  Aan: Struts Users Mailing List
  Onderwerp: Re: Validation problem
 
 
  When you add your error message to the errors object, you are specifying
  Action.ERROR_KEY instead of ActionErrors.GLOBAL_ERROR -- so you'd have
to
 do
  something like
 
  html:errors property=something/ to get that SPECIFIC error.  If you
  switch to ActionErrors.GLOBAL_ERROR it will display all of them with
just
  html:errors/
 
 
  - Original Message -
  From: Johan Kumps [EMAIL PROTECTED]
  To: Struts Users Mailing List [EMAIL PROTECTED]
  Sent: Thursday, February 20, 2003 4:02 PM
  Subject: Validation problem
 
 
   Hi all,
  
   I have a problem displaying error messages. Why is my message not
  displayed?
   Am I doing somthing wrong?
  
   Please help me, I'm loosing time with this one...
  
   Please consider following code :
  
   Form class :
  
   ...
  
   public ActionErrors validate(ActionMapping mapping, HttpServletRequest
   request) {
   ActionErrors errors = new ActionErrors();
  
   if(email == null || !checkEmail(email)) {
   errors.add(Action.ERROR_KEY, new
   ActionError(error.invalid.email));
   }
   return errors;
   }
  
 
   JSP :
  
   html:errors/
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
  ---
  Incoming mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003
 
  ---
  This mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003
 
 
  -
  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]


 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003

 ---
 This mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003


 -
 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]


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003

---
This mail

Re: Validation problem

2003-02-20 Thread Ian Hunter
The only thing I can think of is that the particular key you're referring to
isn't present.  If you want to, post your errors.add() code as well as your
application resource bundle.
- Original Message -
From: Johan Kumps [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, February 20, 2003 4:55 PM
Subject: RE: Validation problem


 no app did not complain

 -Oorspronkelijk bericht-
 Van: Ian Hunter [mailto:[EMAIL PROTECTED]]
 Verzonden: donderdag 20 februari 2003 22:55
 Aan: Struts Users Mailing List
 Onderwerp: Re: Validation problem


 Did the logic:notPresent tag cause your app to complain about not having
 the resources loaded?

 - Original Message -
 From: Johan Kumps [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Thursday, February 20, 2003 4:51 PM
 Subject: RE: Validation problem


  I implemented your second option.
 
  -Oorspronkelijk bericht-
  Van: Ian Hunter [mailto:[EMAIL PROTECTED]]
  Verzonden: donderdag 20 februari 2003 22:35
  Aan: Struts Users Mailing List
  Onderwerp: Re: Validation problem
 
 
  Did you switch to ActionErrors.GLOBAL_KEY or change your JSP code?
 
  1)  If you changed your JSP to html:errors property=ERROR_KEY/ or
  something, keep this in mind: I use a class called Constants for each
 web
  app and refer to Constants.LOGINERROR_KEY in my code, but I have to make
  sure that my JSP has the correct text.  What is the name of the
 property/key
  you're assigning the error to?
 
  2)  If you shifted to ActionErrors.GLOBAL_KEY, are you sure your locale
is
  right and your Resource bundle has the appropriate text key?
 
  Try throwing this code in your JSP:
 
  logic:notPresent name=org.apache.struts.action.MESSAGE
  scope=application
font color=red
  ERROR:  Language independent messages not loaded -- contact
  administrator
  for assistance.
/font
  /logic:notPresent
 
 
  - Original Message -
  From: Johan Kumps [EMAIL PROTECTED]
  To: Struts Users Mailing List [EMAIL PROTECTED]
  Sent: Thursday, February 20, 2003 4:25 PM
  Subject: RE: Validation problem
 
 
   Thanks for your help.
  
   My jsp is displaying : ???nl_BE.error.invalid.email???
  
   Still something wrong. It seems my key is not found.
  
   Can you help me again please?
  
   Kind regards,
  
   -Oorspronkelijk bericht-
   Van: Ian Hunter [mailto:[EMAIL PROTECTED]]
   Verzonden: donderdag 20 februari 2003 22:15
   Aan: Struts Users Mailing List
   Onderwerp: Re: Validation problem
  
  
   When you add your error message to the errors object, you are
specifying
   Action.ERROR_KEY instead of ActionErrors.GLOBAL_ERROR -- so you'd have
 to
  do
   something like
  
   html:errors property=something/ to get that SPECIFIC error.  If
you
   switch to ActionErrors.GLOBAL_ERROR it will display all of them with
 just
   html:errors/
  
  
   - Original Message -
   From: Johan Kumps [EMAIL PROTECTED]
   To: Struts Users Mailing List [EMAIL PROTECTED]
   Sent: Thursday, February 20, 2003 4:02 PM
   Subject: Validation problem
  
  
Hi all,
   
I have a problem displaying error messages. Why is my message not
   displayed?
Am I doing somthing wrong?
   
Please help me, I'm loosing time with this one...
   
Please consider following code :
   
Form class :
   
...
   
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest
request) {
ActionErrors errors = new ActionErrors();
   
if(email == null || !checkEmail(email)) {
errors.add(Action.ERROR_KEY, new
ActionError(error.invalid.email));
}
return errors;
}
   
  
JSP :
   
html:errors/
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
   ---
   Incoming mail is certified Virus Free.
   Checked by AVG anti-virus system (http://www.grisoft.com).
   Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003
  
   ---
   This mail is certified Virus Free.
   Checked by AVG anti-virus system (http://www.grisoft.com).
   Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003
  
  
   -
   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]
 
 
  ---
  Incoming mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02/2003
 
  ---
  This mail is certified Virus Free.
  Checked by AVG anti-virus system (http://www.grisoft.com).
  Version: 6.0.454 / Virus Database: 253 - Release Date: 10/02

Re: validation problem

2001-07-15 Thread Yuriy Zubarev

David,

Yes it is. I think that userForm exists after the validation
process (otherwise I would have gotten an error earlier), but something is
wrong
with countriesList. The form is quite big so I'll post part of it.

html:html
...
html:form action=/saveUser
html:hidden property=action/
html:hidden property=id/
...
html:text property=lastName size=20/
...
bean:define id=cl name=userForm property=countriesList/
html:select property=country
  html:options collection=cl property=code
labelProperty=description/
/html:select
...
/html:form
...
/html:html


Thank you for your time.

Best of luck,
Yuriy Zubarev


- Original Message -
From: David Winterfeldt [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, July 14, 2001 8:48 PM
Subject: Re: validation problem


 Is your bean:define inside your html:form tags?  If
 the userForm doesn't exist, you would get a null
 pointer exception trying to call it.  If this doesn't
 help, seeing the whole form might.

 David

 --- Yuriy Zubarev [EMAIL PROTECTED] wrote:
  Salutation to everyne!
 
  I have a form (extends ActionForm) that has a
  property countriesList
  which holds a list of beans. In jsp form page I have
  a code:
 
  bean:define id=cl name=userForm
  property=countriesList/
 
  which is executed without problems when the page is
  shown first time,
  but when I click submit without entering values into
  textboxes,
  valiate method of my UserForm works out and
  redirects the flaw
  back to user.jsp and here I get exception. Looks
  like countryList
  property vanishes from userForm.
 
  Jul 14, 2001 5:43:43 PM PDT Info HTTP
  [WebAppServletContext(2485833,haa)] action:
  Validation error(s), redire
  cting to: /user.jsp
  Jul 14, 2001 5:43:43 PM PDT Error HTTP
  [WebAppServletContext(2485833,haa)] Servlet failed
  with Exception
  java.lang.NullPointerException
  at
 
 weblogic.utils.UnsyncHashtable.put(UnsyncHashtable.java:272)
  at
 

weblogic.servlet.jsp.PageContextImpl.setAttribute(PageContextImpl.java:124)
  at
 

weblogic.servlet.jsp.PageContextImpl.setAttribute(PageContextImpl.java:149)
  at
 
 org.apache.struts.taglib.bean.DefineTag.doStartTag(DefineTag.java:210)
  at
  jsp_servlet._user._jspService(_user.java:1899)
  at
 
 weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
  at
 

weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:213)
  at
 

weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp
l.java:157)
  at
 

org.apache.struts.action.ActionServlet.processValidate(ActionServlet.java:21
49)
  at
 
 org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564)
  at
 
 org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
  at
 
 javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
  at
 
 javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  at
 

weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:213)
  at
 

weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:1265)
  at
 

weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:1631)
  at
 
 weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
  at
 
 weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
 
  Any help will be highly appreciated.
 
  Thank you for your time.
 
  Best of luck,
  Yuriy Zubarev
 
 
  __
  Do You Yahoo!?
  Get personalized email addresses from Yahoo! Mail
  http://personal.mail.yahoo.com/


 __
 Do You Yahoo!?
 Get personalized email addresses from Yahoo! Mail
 http://personal.mail.yahoo.com/



Re: validation problem

2001-07-15 Thread Gregor Rayman

Yuriy Zubarev [EMAIL PROTECTED] wrote:


 David,

 Yes it is. I think that userForm exists after the validation
 process (otherwise I would have gotten an error earlier), but something is
 wrong
 with countriesList. The form is quite big so I'll post part of it.

The problem might be that your form is in the request scope and your
countries list does not get populated from the submitted data. I've
similar problems when I used the ActionForm for displaying read
only properties which did not have an html:hidden on the jsp page.

In request scope it works something like this:

The ActionForm instace (A1) is used to fill jour JSP. A1 has been
probably prepared by some Action. After delivering the response
(JSP) the instace A1 is forgotten and eventually garbage collected.

The teh user sumbits your JSP. New instace (A2) of your ActionForm is
created and filled with the sumbitted values. If the countries
list is neither filled in the reset() method, nor the constructor,
nor the sumbitted HTTP parameters, than it might be empty or null.

Because the instace A1 and A2 are different.

If the form is in session scope, than A1 is preserved.

--
gR




Re: validation problem

2001-07-14 Thread David Winterfeldt

Is your bean:define inside your html:form tags?  If
the userForm doesn't exist, you would get a null
pointer exception trying to call it.  If this doesn't
help, seeing the whole form might.

David

--- Yuriy Zubarev [EMAIL PROTECTED] wrote:
 Salutation to everyne!
 
 I have a form (extends ActionForm) that has a
 property countriesList
 which holds a list of beans. In jsp form page I have
 a code:
 
 bean:define id=cl name=userForm
 property=countriesList/
 
 which is executed without problems when the page is
 shown first time,
 but when I click submit without entering values into
 textboxes,
 valiate method of my UserForm works out and
 redirects the flaw
 back to user.jsp and here I get exception. Looks
 like countryList
 property vanishes from userForm.
 
 Jul 14, 2001 5:43:43 PM PDT Info HTTP
 [WebAppServletContext(2485833,haa)] action:  
 Validation error(s), redire
 cting to: /user.jsp
 Jul 14, 2001 5:43:43 PM PDT Error HTTP
 [WebAppServletContext(2485833,haa)] Servlet failed
 with Exception
 java.lang.NullPointerException
 at

weblogic.utils.UnsyncHashtable.put(UnsyncHashtable.java:272)
 at

weblogic.servlet.jsp.PageContextImpl.setAttribute(PageContextImpl.java:124)
 at

weblogic.servlet.jsp.PageContextImpl.setAttribute(PageContextImpl.java:149)
 at

org.apache.struts.taglib.bean.DefineTag.doStartTag(DefineTag.java:210)
 at
 jsp_servlet._user._jspService(_user.java:1899)
 at

weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
 at

weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:213)
 at

weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:157)
 at

org.apache.struts.action.ActionServlet.processValidate(ActionServlet.java:2149)
 at

org.apache.struts.action.ActionServlet.process(ActionServlet.java:1564)
 at

org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
 at

javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
 at

javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at

weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:213)
 at

weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:1265)
 at

weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1631)
 at

weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
 at

weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
 
 Any help will be highly appreciated.
 
 Thank you for your time.
 
 Best of luck,
 Yuriy Zubarev
 
 
 __
 Do You Yahoo!?
 Get personalized email addresses from Yahoo! Mail
 http://personal.mail.yahoo.com/


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/