Any Takers ?RE: Struts Validator and Select boxes

2004-03-26 Thread Janarthan Sathiamurthy
Any help/takers ?

-Original Message-
From: Janarthan Sathiamurthy 
Sent: Thursday, March 25, 2004 10:16 PM
To: [EMAIL PROTECTED]
Subject: Struts Validator and Select boxes


Hi,

I am using Struts validator.
One page of mine has dates displayed as MM  DD .
All the above 3 are displayed in seprate combo/select boxes.
I need to do some custom validations on these fields.
I wrote a custom class for the same 
Looks like - 
   public static boolean validateDates(Object bean,
ValidatorAction validatorAction,
Field field, ActionErrors errors,
HttpServletRequest request)
   {
  String actionType = ValidatorUtil.getValueAsString(bean,
 
field.getVarValue(actionType)); // A hidden form field
  String fromMonth = ValidatorUtil.getValueAsString(bean,
field.getProperty());
  String fromDay = ValidatorUtil.getValueAsString(bean,
  field.getVarValue(fromDay));
  String fromYear = ValidatorUtil.getValueAsString(bean,
   field.getVarValue(fromYear));
  String toMonth = ValidatorUtil.getValueAsString(bean,
  field.getVarValue(toMonth));
  String toDay = ValidatorUtil.getValueAsString(bean,
field.getVarValue(toDay));
  String toYear = ValidatorUtil.getValueAsString(bean,
 field.getVarValue(toYear));

  System.out.println(actionType  + actionType);
  System.out.println(fromMonth  + fromMonth);
  System.out.println(fromDay  + fromDay);
  System.out.println(fromYear  + fromYear);
  System.out.println(toMonth  + toMonth);
  System.out.println(toDay  + toDay);
  System.out.println(toYear  + toYear);

  return true;
   }

O/P of the above code - 
actionType searchPage
fromMonth 2
fromDay null
fromYear null
toMonth null
toDay null
toYear null

It also gives me No Name Specified error.
Point to note is that the all other fields other than 'actionType' are select boxes. 
It gives a null for all the field types that are of html:select.
Is this a known BUG or am i going wrong somewhere ? 


Error LOG -
Mar 25, 2004 9:53:11 PM org.apache.commons.validator.ValidatorUtil getValueAsString
SEVERE: No name specified
java.lang.IllegalArgumentException: No name specified
at 
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:721)
at 
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:801)
at 
org.apache.commons.validator.ValidatorUtil.getValueAsString(ValidatorUtil.java:121)
at 
com.mot.servicetools.util.OCSReportsDateValidator.validateDates(OCSReportsDateValidator.j
ava:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at 
org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:454)
at org.apache.commons.validator.Validator.validateField(Validator.java:544)
at org.apache.commons.validator.Validator.validate(Validator.java:582)
at 
org.apache.struts.validator.DynaValidatorActionForm.validate(DynaValidatorActionForm.java
:125)
at 
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:942)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at 
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.jav
a:1053)
at 
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)
at 
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
at 
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletC
ontext.java:6310)
at 
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at 
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:36
22)
at 
weblogic.servlet.internal.ServletRequestImpl.execute

Re: Struts Validator and Select boxes

2004-03-26 Thread Niall Pemberton
Posting whats in your validation.xml for the form and the bit of your jsp
with your select fields would be helpfull.

If you take the fromDay as an example, you are using
field.getVarValue(fromDay)  - if you don't have a var defined in your
validation.xml for fromDay then that would cause the No Name Specified
error - same goes for fromYear, toMonth, toDay and toYear.

As for getting nulls, looks to me again that whats specified for the vars
in your validation.xml doesn't tie up with the names specified on your form.

From your code I would expect something like the following in your
validation.xml

form.
field 
varvar-namefromDay/var-name
  var-valueformFromDay/var-value
/var
varvar-namefromYear/var-name
  var-valueformFromYear/var-value
/var
varvar-nametoMonth/var-name
  var-valueformToMonth/var-value
/var
varvar-nametoDay/var-name
  var-valueformToDay/var-value
/var
varvar-nametoYear/var-name
  var-valueformToYear/var-value
/var
/field
/form

Do you have the properties in your form correct (i.e in this example
formFromDay, formFromYear, formToMonth, formToDay, formToYear).

Niall


- Original Message - 
From: Janarthan Sathiamurthy [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 4:46 PM
Subject: Struts Validator and Select boxes


Hi,

I am using Struts validator.
One page of mine has dates displayed as MM  DD .
All the above 3 are displayed in seprate combo/select boxes.
I need to do some custom validations on these fields.
I wrote a custom class for the same
Looks like -
   public static boolean validateDates(Object bean,
ValidatorAction validatorAction,
Field field, ActionErrors errors,
HttpServletRequest request)
   {
  String actionType = ValidatorUtil.getValueAsString(bean,

field.getVarValue(actionType)); // A hidden form field
  String fromMonth = ValidatorUtil.getValueAsString(bean,

field.getProperty());
  String fromDay = ValidatorUtil.getValueAsString(bean,

field.getVarValue(fromDay));
  String fromYear = ValidatorUtil.getValueAsString(bean,

field.getVarValue(fromYear));
  String toMonth = ValidatorUtil.getValueAsString(bean,

field.getVarValue(toMonth));
  String toDay = ValidatorUtil.getValueAsString(bean,

field.getVarValue(toDay));
  String toYear = ValidatorUtil.getValueAsString(bean,

field.getVarValue(toYear));

  System.out.println(actionType  + actionType);
  System.out.println(fromMonth  + fromMonth);
  System.out.println(fromDay  + fromDay);
  System.out.println(fromYear  + fromYear);
  System.out.println(toMonth  + toMonth);
  System.out.println(toDay  + toDay);
  System.out.println(toYear  + toYear);

  return true;
   }

O/P of the above code -
actionType searchPage
fromMonth 2
fromDay null
fromYear null
toMonth null
toDay null
toYear null

It also gives me No Name Specified error.
Point to note is that the all other fields other than 'actionType' are
select boxes. It gives a null for all the field types that are of
html:select.
Is this a known BUG or am i going wrong somewhere ?


Error LOG -
Mar 25, 2004 9:53:11 PM org.apache.commons.validator.ValidatorUtil
getValueAsString
SEVERE: No name specified
java.lang.IllegalArgumentException: No name specified
at
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.j
ava:721)
at
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:80
1)
at
org.apache.commons.validator.ValidatorUtil.getValueAsString(ValidatorUtil.ja
va:121)
at
com.mot.servicetools.util.OCSReportsDateValidator.validateDates(OCSReportsDa
teValidator.j
ava:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:4
54)
at
org.apache.commons.validator.Validator.validateField(Validator.java:544)
at
org.apache.commons.validator.Validator.validate(Validator.java:582)
at
org.apache.struts.validator.DynaValidatorActionForm.validate(DynaValidatorAc
tionForm.java
:125)
at
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.j
ava:942)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525

RE: Struts Validator and Select boxes

2004-03-26 Thread Janarthan Sathiamurthy
Hi Niall,

I am attaching the validation.xml and the jsp that i have used.
I have done the exact thing that you had specified earlier before posting
to the mailing list.
I am not clear where i am going wrong.

The Struts-config entry goes like - 
form-bean name=ocsReportForm 
type=org.apache.struts.validator.DynaValidatorActionForm
form-property name=monthFrom type=java.lang.String /
form-property name=dayFrom type=java.lang.String /
form-property name=yearFrom type=java.lang.String /
form-property name=monthTo type=java.lang.String /
form-property name=dayTo type=java.lang.String /
form-property name=yearTo type=java.lang.String /
form-property name=actionType type=java.lang.String /
form-property name=pageNumber type=java.lang.String /
form-property name=numberOfRows type=java.lang.String /
form-property name=dateFrom type=java.lang.String /
form-property name=dateTo type=java.lang.String /
/form-bean

Regards,
Janarthan S

-Original Message-
From: Niall Pemberton [mailto:[EMAIL PROTECTED]
Sent: Friday, March 26, 2004 8:55 PM
To: Struts Users Mailing List
Subject: Re: Struts Validator and Select boxes


Posting whats in your validation.xml for the form and the bit of your jsp
with your select fields would be helpfull.

If you take the fromDay as an example, you are using
field.getVarValue(fromDay)  - if you don't have a var defined in your
validation.xml for fromDay then that would cause the No Name Specified
error - same goes for fromYear, toMonth, toDay and toYear.

As for getting nulls, looks to me again that whats specified for the vars
in your validation.xml doesn't tie up with the names specified on your form.

From your code I would expect something like the following in your
validation.xml

form.
field 
varvar-namefromDay/var-name
  var-valueformFromDay/var-value
/var
varvar-namefromYear/var-name
  var-valueformFromYear/var-value
/var
varvar-nametoMonth/var-name
  var-valueformToMonth/var-value
/var
varvar-nametoDay/var-name
  var-valueformToDay/var-value
/var
varvar-nametoYear/var-name
  var-valueformToYear/var-value
/var
/field
/form

Do you have the properties in your form correct (i.e in this example
formFromDay, formFromYear, formToMonth, formToDay, formToYear).

Niall


- Original Message - 
From: Janarthan Sathiamurthy [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 4:46 PM
Subject: Struts Validator and Select boxes


Hi,

I am using Struts validator.
One page of mine has dates displayed as MM  DD .
All the above 3 are displayed in seprate combo/select boxes.
I need to do some custom validations on these fields.
I wrote a custom class for the same
Looks like -
   public static boolean validateDates(Object bean,
ValidatorAction validatorAction,
Field field, ActionErrors errors,
HttpServletRequest request)
   {
  String actionType = ValidatorUtil.getValueAsString(bean,

field.getVarValue(actionType)); // A hidden form field
  String fromMonth = ValidatorUtil.getValueAsString(bean,

field.getProperty());
  String fromDay = ValidatorUtil.getValueAsString(bean,

field.getVarValue(fromDay));
  String fromYear = ValidatorUtil.getValueAsString(bean,

field.getVarValue(fromYear));
  String toMonth = ValidatorUtil.getValueAsString(bean,

field.getVarValue(toMonth));
  String toDay = ValidatorUtil.getValueAsString(bean,

field.getVarValue(toDay));
  String toYear = ValidatorUtil.getValueAsString(bean,

field.getVarValue(toYear));

  System.out.println(actionType  + actionType);
  System.out.println(fromMonth  + fromMonth);
  System.out.println(fromDay  + fromDay);
  System.out.println(fromYear  + fromYear);
  System.out.println(toMonth  + toMonth);
  System.out.println(toDay  + toDay);
  System.out.println(toYear  + toYear);

  return true;
   }

O/P of the above code -
actionType searchPage
fromMonth 2
fromDay null
fromYear null
toMonth null
toDay null
toYear null

It also gives me No Name Specified error.
Point to note is that the all other fields other than 'actionType' are
select boxes. It gives a null for all the field types that are of
html:select.
Is this a known BUG or am i going wrong somewhere ?


Error LOG -
Mar 25, 2004 9:53:11 PM org.apache.commons.validator.ValidatorUtil
getValueAsString
SEVERE: No name specified
java.lang.IllegalArgumentException: No name specified

Struts Validator and Select boxes

2004-03-25 Thread Janarthan Sathiamurthy
Hi,

I am using Struts validator.
One page of mine has dates displayed as MM  DD .
All the above 3 are displayed in seprate combo/select boxes.
I need to do some custom validations on these fields.
I wrote a custom class for the same 
Looks like - 
   public static boolean validateDates(Object bean,
ValidatorAction validatorAction,
Field field, ActionErrors errors,
HttpServletRequest request)
   {
  String actionType = ValidatorUtil.getValueAsString(bean,
 
field.getVarValue(actionType)); // A hidden form field
  String fromMonth = ValidatorUtil.getValueAsString(bean,
field.getProperty());
  String fromDay = ValidatorUtil.getValueAsString(bean,
  field.getVarValue(fromDay));
  String fromYear = ValidatorUtil.getValueAsString(bean,
   field.getVarValue(fromYear));
  String toMonth = ValidatorUtil.getValueAsString(bean,
  field.getVarValue(toMonth));
  String toDay = ValidatorUtil.getValueAsString(bean,
field.getVarValue(toDay));
  String toYear = ValidatorUtil.getValueAsString(bean,
 field.getVarValue(toYear));

  System.out.println(actionType  + actionType);
  System.out.println(fromMonth  + fromMonth);
  System.out.println(fromDay  + fromDay);
  System.out.println(fromYear  + fromYear);
  System.out.println(toMonth  + toMonth);
  System.out.println(toDay  + toDay);
  System.out.println(toYear  + toYear);

  return true;
   }

O/P of the above code - 
actionType searchPage
fromMonth 2
fromDay null
fromYear null
toMonth null
toDay null
toYear null

It also gives me No Name Specified error.
Point to note is that the all other fields other than 'actionType' are select boxes. 
It gives a null for all the field types that are of html:select.
Is this a known BUG or am i going wrong somewhere ? 


Error LOG -
Mar 25, 2004 9:53:11 PM org.apache.commons.validator.ValidatorUtil getValueAsString
SEVERE: No name specified
java.lang.IllegalArgumentException: No name specified
at 
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:721)
at 
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:801)
at 
org.apache.commons.validator.ValidatorUtil.getValueAsString(ValidatorUtil.java:121)
at 
com.mot.servicetools.util.OCSReportsDateValidator.validateDates(OCSReportsDateValidator.j
ava:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at 
org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:454)
at org.apache.commons.validator.Validator.validateField(Validator.java:544)
at org.apache.commons.validator.Validator.validate(Validator.java:582)
at 
org.apache.struts.validator.DynaValidatorActionForm.validate(DynaValidatorActionForm.java
:125)
at 
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:942)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at 
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.jav
a:1053)
at 
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)
at 
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
at 
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletC
ontext.java:6310)
at 
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at 
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:36
22)
at 
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2569)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

Thanks  Regards,

Janarthan S

Re: Struts Validator

2004-03-24 Thread Niall Pemberton
Whats missing from your question is how are you identifying which client a
user belongs to?

Niall

- Original Message - 
From: Matthew Clark [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, March 22, 2004 12:09 PM
Subject: Struts Validator


Hi there,

I am new to Struts and this mailing list but by no means new to Java.  I
have been reading the Struts in Action book and taken a quick look at
the API etc and have a simple question regarding the Validator in my
environment.

We are an Application Service Provider and serve well over 1000 clients
(who in turn each have between 5 and 1000 end users using the system).
Although each client uses the same core application, they can have very
different views of data and input forms and may have very different
validation requirements.

Is it possible to specify validation config at runtime when using the
struts validator?  So each of our clients could have a configuration
file that specified which validation XML file to use for a given input
form?  We could use a different form for each user but that would be
inefficient and a maintenance nightmare.. I want to call the same
form/servlet but have it display a different look  feel and have
different validation rules client side and server side.  At the moment,
the validation is very much tied to the presentation layer and I want to
decouple it.

This is really the last obstacle standing in the way of our migration to
a pure java solution using Struts..  The use of the validator would
simplify our solution a great deal and I will also be looking into the
possibility of our clients creating their own validation configuration
files (using a web interface of some sort)

any help or advice would be appreciated.

Regards,

Matthew



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



Validator and Resourcebundles and modules

2004-03-24 Thread hermod . opstvedt
Hi

Is there a way of telling the Validator which Resourcebundle it should
get its resources from? I have multi-module Strut application, each
module has its own Resourcebundle (ApplicationResources-moda.poperties,
ApplicationResources-modb.poperties etc). I have not been able to figure
out how to make it read from the various bundles. It insists on looking
in the default (ApplicationResources.poperties).

Hermod


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

This email with attachments is solely for the use of the individual or
entity to whom it is addressed. Please also be aware that DnB NOR cannot
accept any payment orders or other legally binding correspondence with
customers as a part of an email. 

This email message has been virus checked by the virus programs used
in the DnB NOR Group.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


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



Struts validator Regular Expressions

2004-03-24 Thread Joao Batistella
Hello!

Do you know any document where can I learn how to build regular expressions
for Struts Validator?

I need to validate an IP address and I don't know how is the syntax in the
validator config file.

Thanks,
JP


RE: Struts validator Regular Expressions

2004-03-24 Thread Takhar, Sandeep
don't quote me but the javadocs for jakarta's regular expression's RE class are ok.

Also I believe everything is based on jakarta's oro.

sandeep

-Original Message-
From: Joao Batistella [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 24, 2004 1:33 PM
To: 'Struts Users Mailing List'
Subject: Struts validator Regular Expressions


Hello!

Do you know any document where can I learn how to build regular expressions
for Struts Validator?

I need to validate an IP address and I don't know how is the syntax in the
validator config file.

Thanks,
JP

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



Re: Struts validator Regular Expressions

2004-03-24 Thread Frank Schaare
Hi,

this should be very close to \d{1,3}[.]\d{1,3}[.]\d{1,3}[.]\d{1,3}
I need to validate an IP address and I don't know how is the syntax in the
validator config file.
take your time to study this: 
http://java.sun.com/docs/books/tutorial/extra/regex/
It's worth the trouble, regex rox !

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


Re: Struts validator Regular Expressions

2004-03-24 Thread Niall Pemberton
Validator does use ORO - There is an applet you can play with to test your
regexp:

http://jakarta.apache.org/oro/demo.html

Choose the contains option and start/end your regular expressions with ^
and $

Niall

- Original Message - 
From: Takhar, Sandeep [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Wednesday, March 24, 2004 6:52 PM
Subject: RE: Struts validator Regular Expressions


don't quote me but the javadocs for jakarta's regular expression's RE class
are ok.

Also I believe everything is based on jakarta's oro.

sandeep

-Original Message-
From: Joao Batistella [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 24, 2004 1:33 PM
To: 'Struts Users Mailing List'
Subject: Struts validator Regular Expressions


Hello!

Do you know any document where can I learn how to build regular expressions
for Struts Validator?

I need to validate an IP address and I don't know how is the syntax in the
validator config file.

Thanks,
JP

-
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 validator Regular Expressions

2004-03-24 Thread Janarthan Sathiamurthy
Hi,

This is a good one to get started -
http://weblogtoolscollection.com/regex/regex.php

Best Regards,
Janarthan S

-Original Message-
From: Joao Batistella [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 12:03 AM
To: 'Struts Users Mailing List'
Subject: Struts validator Regular Expressions


Hello!

Do you know any document where can I learn how to build regular expressions
for Struts Validator?

I need to validate an IP address and I don't know how is the syntax in the
validator config file.

Thanks,
JP

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



Struts Validator

2004-03-22 Thread Matthew Clark
Hi there,
 
I am new to Struts and this mailing list but by no means new to Java.  I
have been reading the Struts in Action book and taken a quick look at
the API etc and have a simple question regarding the Validator in my
environment.
 
We are an Application Service Provider and serve well over 1000 clients
(who in turn each have between 5 and 1000 end users using the system).
Although each client uses the same core application, they can have very
different views of data and input forms and may have very different
validation requirements.  
 
Is it possible to specify validation config at runtime when using the
struts validator?  So each of our clients could have a configuration
file that specified which validation XML file to use for a given input
form?  We could use a different form for each user but that would be
inefficient and a maintenance nightmare.. I want to call the same
form/servlet but have it display a different look  feel and have
different validation rules client side and server side.  At the moment,
the validation is very much tied to the presentation layer and I want to
decouple it.
 
This is really the last obstacle standing in the way of our migration to
a pure java solution using Struts..  The use of the validator would
simplify our solution a great deal and I will also be looking into the
possibility of our clients creating their own validation configuration
files (using a web interface of some sort)
 
any help or advice would be appreciated.
 
Regards,
 
Matthew


validator form and OR-relations between fields

2004-03-19 Thread Stefan Burkard
hi struts-users

is it possible with the validator-framework to check if ONE of TWO 
fields contains text?

i just see the possibility to set both fields as required or not, but 
not to say if in one of the two fields is text, the forms ok

thanks and greetings
stefan
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: validator form and OR-relations between fields

2004-03-19 Thread Stefan Burkard
ok, i found myself some infos at 
http://jakarta.apache.org/struts/userGuide/dev_validator.html

ist there any possibility to use the struts 1.2.0-validators without 
using a nightly build? something like a milestone-build perhaps? or by 
using the commons validator itself?

thanks and greetings
stefan
Stefan Burkard wrote:
hi struts-users

is it possible with the validator-framework to check if ONE of TWO 
fields contains text?

i just see the possibility to set both fields as required or not, but 
not to say if in one of the two fields is text, the forms ok

thanks and greetings
stefan


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


Re: Map-backed Forms and Struts Validator

2004-03-18 Thread Adam Hardy
Hi Derek,

from the ppt doc, it looks like validWhen is using a syntax that is 
designed for checking indexed properties. I haven't used it though.

I assume that it would handle nested beans as well, in accordance with 
the rest of the action form functionality. But again, I don't know.

Also it says you can't use validWhen until you upgrade to struts 1.2 or 
a nightly build.

I admit, it doesn't look hopeful. Have you tried a simple test case 
using the syntax like in the ppt doc?

Adam

On 03/18/2004 12:56 AM Derek Richardson wrote:
Read through the various Struts validator docs and the map-backed
form faq but didn't see this. James Turner's Indexed Properties and
Validation presentation
(http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt)
came close, but still not explicit enough for me to figure out. :(
Struts 1.1. Uses Commons Validator 1.0.2.

Is it possible to use the Struts validator to validate beans stored
in a map-backed form? If so, does anyone have an example at-hand to
send me?


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


Re: Validator: Validation based on action path and not by form name

2004-03-18 Thread Adam Hardy
Kamakshya,
if you use the ValidatorActionForm instead of the ValidatorForm, then 
you can do this.

Adam

On 03/18/2004 08:26 AM Prasad, Kamakshya wrote:
Hi All,
 
Is it possible for validation.xml to take action path attribute instead
of form name for putting javascript validation rules for a page? 
 
I am having a page with lot of buttons, each mapping to a particular
action path. I want to validate the screen elements based on these
action paths and not as a whole form.
 
Please let me know if there is any such facility provided by struts.
 
Regards,
Kamakshya
 



--
struts 1.1 + tomcat 5.0.16 + java 1.4.2
Linux 2.4.20 Debian
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Validator: Validation based on action path and not by form name

2004-03-18 Thread Prasad, Kamakshya
Thanks Adam,

But what exactly I have to put in validation.xml

Now the xml has these lines 

formset
form name=assetForm

Should I change it to?

formset
action path=/resolveAsset

Regards
Kamakshya

-Original Message-
From: Adam Hardy [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 18, 2004 7:19 PM
To: Struts Users Mailing List
Subject: Re: Validator: Validation based on action path and not by form
name

Kamakshya,
if you use the ValidatorActionForm instead of the ValidatorForm, then 
you can do this.

Adam

On 03/18/2004 08:26 AM Prasad, Kamakshya wrote:
 Hi All,
  
 Is it possible for validation.xml to take action path attribute
instead
 of form name for putting javascript validation rules for a page? 
  
 I am having a page with lot of buttons, each mapping to a particular
 action path. I want to validate the screen elements based on these
 action paths and not as a whole form.
  
 Please let me know if there is any such facility provided by struts.
  
 Regards,
 Kamakshya
  
 


-- 
struts 1.1 + tomcat 5.0.16 + java 1.4.2
Linux 2.4.20 Debian


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



[partly answered] Re: Validator: Validation based on action path and not by form name

2004-03-18 Thread Axel Gross
Hi Kamakshya!

yes it is provided. just make it a ValidatorActionForm instead of a
ValidatorForm. (check docs for further info)
If you use DynaFormBeans, there is a DynaValdaterActionForm, but it never
worked for me...

hope this help,
Axel

On 2004-03-18 at 13:40:27 +0900, Prasad, Kamakshya wrote:
 Hi All,
  
 Is it possible for validation.xml to take action path attribute instead
 of form name for putting javascript validation rules for a page? 
  
 I am having a page with lot of buttons, each mapping to a particular
 action path. I want to validate the screen elements based on these
 action paths and not as a whole form.
  
 Please let me know if there is any such facility provided by struts.
  
 Regards,
 Kamakshya

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



Re: Validator: Validation based on action path and not by form name

2004-03-18 Thread Axel Groß
form name=/resolveAsset
as far as i can remember

On 2004-03-18 at 19:36:05 +0900, Prasad, Kamakshya wrote:
 Thanks Adam,
 
 But what exactly I have to put in validation.xml
 
 Now the xml has these lines 
 
 formset
   form name=assetForm
 
 Should I change it to?
 
 formset
   action path=/resolveAsset
 
 Regards
 Kamakshya
 
 -Original Message-
 From: Adam Hardy [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, March 18, 2004 7:19 PM
 To: Struts Users Mailing List
 Subject: Re: Validator: Validation based on action path and not by form
 name
 
 Kamakshya,
 if you use the ValidatorActionForm instead of the ValidatorForm, then 
 you can do this.
 
 Adam
 
 On 03/18/2004 08:26 AM Prasad, Kamakshya wrote:
  Hi All,
   
  Is it possible for validation.xml to take action path attribute
 instead
  of form name for putting javascript validation rules for a page? 
   
  I am having a page with lot of buttons, each mapping to a particular
  action path. I want to validate the screen elements based on these
  action paths and not as a whole form.
   
  Please let me know if there is any such facility provided by struts.
   
  Regards,
  Kamakshya
   
  
 
 
 -- 
 struts 1.1 + tomcat 5.0.16 + java 1.4.2
 Linux 2.4.20 Debian
 
 
 -
 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]



Map-backed Forms and Struts Validator

2004-03-17 Thread Derek Richardson
Read through the various Struts validator docs and the map-backed form faq but didn't 
see this. James Turner's Indexed Properties and Validation presentation 
(http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt) came close, but 
still not explicit enough for me to figure out. :(

Struts 1.1. Uses Commons Validator 1.0.2.

Is it possible to use the Struts validator to validate beans stored in a map-backed 
form? If so, does anyone have an example at-hand to send me?

Thanks,

Derek Richardson

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



RE: [SOLVED] Struts Validator prints all javascript functions

2004-03-17 Thread Kunal H. Parikh
Hi All!

After some debugging, I worked out that there are two variables
dynamicJavaScript and staticJavaScript in the JavascriptValidatorTag
class.

By default, their values are true. And Hence, the staticJavaScript also
gets included in the response.

i.e. to only display relevant JS methods, your html:javascript tag should
look like,


html:javascript formName=myformName dynamicJavascript=true
staticJavascript=false /


cheers,

kunal


-Original Message-
From: Kunal H. Parikh [mailto:[EMAIL PROTECTED] 
Sent: Monday, 15 March 2004 08:55
To: 'Struts Users Mailing List'
Subject: Struts Validator prints all javascript functions

Hi All!

I am attempting to use Struts Validator.

All works well, but I am only using the required validation in my code.

However, the JavaScript that gets generated, include other functions like
checkEmail, minLength, etc. etc.

Is this expected behaviour?

My code (FYI):
===
html:form name=vehicleEnquiry action=/vehicleEnquiry.do method=post
type=org.apache.struts.validator.DynaValidatorActionForm onsubmit=return(
validateVehicleEnquiry(this) );  



tr
tdbean:message key=label.name /:/td
td html:text property=name value= / /td
/tr


html:submit value=Send Enquiry /
/html:form
html:javascript formName=vehicleEnquiry /
==

TIA,

Kunal



-
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: [SOLVED] Struts Validator prints all javascript functions

2004-03-17 Thread Kunal H. Parikh
Whoops . that didn't quite solve the problem . the real
javascript methods are not quite being appended to the response .

My apologies!



-Original Message-
From: Kunal H. Parikh [mailto:[EMAIL PROTECTED] 
Sent: Thursday, 18 March 2004 12:11
To: 'Struts Users Mailing List'
Cc: 'Joe Germuska'; 'Theodosios Paschalidis'
Subject: RE: [SOLVED] Struts Validator prints all javascript functions 

Hi All!

After some debugging, I worked out that there are two variables
dynamicJavaScript and staticJavaScript in the JavascriptValidatorTag
class.

By default, their values are true. And Hence, the staticJavaScript also
gets included in the response.

i.e. to only display relevant JS methods, your html:javascript tag should
look like,


html:javascript formName=myformName dynamicJavascript=true
staticJavascript=false /


cheers,

kunal


-Original Message-
From: Kunal H. Parikh [mailto:[EMAIL PROTECTED] 
Sent: Monday, 15 March 2004 08:55
To: 'Struts Users Mailing List'
Subject: Struts Validator prints all javascript functions

Hi All!

I am attempting to use Struts Validator.

All works well, but I am only using the required validation in my code.

However, the JavaScript that gets generated, include other functions like
checkEmail, minLength, etc. etc.

Is this expected behaviour?

My code (FYI):
===
html:form name=vehicleEnquiry action=/vehicleEnquiry.do method=post
type=org.apache.struts.validator.DynaValidatorActionForm onsubmit=return(
validateVehicleEnquiry(this) );  



tr
tdbean:message key=label.name /:/td
td html:text property=name value= / /td
/tr


html:submit value=Send Enquiry /
/html:form
html:javascript formName=vehicleEnquiry /
==

TIA,

Kunal



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



Validator: Validation based on action path and not by form name

2004-03-17 Thread Prasad, Kamakshya
Hi All,
 
Is it possible for validation.xml to take action path attribute instead
of form name for putting javascript validation rules for a page? 
 
I am having a page with lot of buttons, each mapping to a particular
action path. I want to validate the screen elements based on these
action paths and not as a whole form.
 
Please let me know if there is any such facility provided by struts.
 
Regards,
Kamakshya


Validator: Validation based on action path and not by form name

2004-03-17 Thread Prasad, Kamakshya
Hi All,
 
Is it possible for validation.xml to take action path attribute instead
of form name for putting javascript validation rules for a page? 
 
I am having a page with lot of buttons, each mapping to a particular
action path. I want to validate the screen elements based on these
action paths and not as a whole form.
 
Please let me know if there is any such facility provided by struts.
 
Regards,
Kamakshya
 


FW: Insert arguments into Validator error messages?

2004-03-15 Thread Brendan Richards


Hi, 

I'm getting exactly this problem posted last year. 
I've seen many posts on validator resource bundles including this patch:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10868

But have not found THE universally adopted solution.

Just to restate the problem: 

I have a resource bundle for each area of my site:
(struts-config.xml)

message-resources parameter=resources.application/
message-resources key=CampaignManagerResources
parameter=resources.CampaignManagerResources/
message-resources key=EmailManagerResources
parameter=resources.EmailManagerResources/

Each resources bundle has a copy of the basic default error messages
like:
errors.required={0} is required.


I have validations like this:


field
property=subject
depends=required
arg0 key=viewEmail.subject /
 /field


And display the error messages like this in a JSP.

html:errors bundle=EmailManagerResources /

With this config, when the validation fails, the message
(errors.required) is pulled from the correct bundle but the argument
(viewEmail.subject) is pulled from the default bundle and not the bundle
specified in the html:errors tag.


Hs anyone used the above patch? It doesn't seem to include an update of
the validation dtd file.


I really don't want to put all my error messages and arguments into one
file...

Any help at all will be gratefully received. From the amount of similar
posts on this list I feel that this is an issue for lots of people


--

From: Andreas Lundgren [EMAIL PROTECTED]
Subject: SV: Insert arguments into Validator error messages?
Date: Tue, 19 Aug 2003 08:06:03 +0100
Content-Type: text/plain;
charset=iso-8859-1

When I removed the key = resource attribute in the message-resource
declaration in the struts-config.xml, hence using the default
Globals.MessageKey it worked... Can anyone please confirm this? All the
error messages and their arguments needs be to set in a resource-bundle
stored in the default Globals.MessageKey? Hence you can't use
html:errors
bundle=resource/ when presenting error messages WITH arguments?

Can anyone confirm that this is the case?

Thank you!

/Andreas


-Ursprungligt meddelande-
Från: Andreas Lundgren [mailto:[EMAIL PROTECTED]
Skickat: den 19 augusti 2003 06:22
Till: [EMAIL PROTECTED]
Ämne: Insert arguments into Validator error messages?


Hi,

I trying to insert an argument into a error message using the Validator
framework and I just can't make it work.

The validation itself works and it shows a nice display of my (TEST)
error
message also, but the argument is somehow lost.
If I use the resource=false attribute it works...

What I am missing here?

validation.xml:

form name=login
field property=name depends=required
arg0 key=label.name /
/field
/form


My bundle namned resource:

errors.required={0} TEST is required.
label.name=Name

And the output is (using html:errors bundle=resource/ )

TEST is required.

And if I use the resource=false attribute:

label.name TEST is required.

Why is the error message key found but not the argument key (label.name)
in
my resource-bundle?

Thankful for your assistance!

/Andreas


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



RE: validator validwhen error (Repost)

2004-03-15 Thread Betty Koon
Anyone has any idea?  I haven't seen anyone's reply.  Thanks.

-Betty

-Original Message-
From: Betty Koon [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 08, 2004 8:07 PM
To: [EMAIL PROTECTED]
Subject: validator validwhen error


Hi,

I got the following validator error, but not sure why.

here is my validator.xml and the exception:

formset
form name=someForm 
field
property=email
depends=validwhen,email
arg0 key=email.error_label/
var
var-nametest/var-name
var-value((actionType != 'x') or (*this* !=
null))/var-value
/var 
/field 
field
property=startDate
depends=validwhen,date
arg0 key=start_date.error_label/
var
var-nametest/var-name
var-value((editAction != 'false') or (*this* !=
null))/var-value
/var
var
var-namedatePatternStrict/var-name
var-valueMM/dd/ HH:mm:ss/var-value
/var
/field
/form
/formset






*
59:03,863 ERROR [STDERR] line 1:23: expecting ''', found '_'
59:03,863 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWh
exer.nextToken(ValidWhenLexer.java:228)
19:58:59,637 ERROR [STDERR] at
antlr.TokenBuffer.fill(TokenBuffer.java:69)
19:58:59,637 ERROR [STDERR] at antlr.TokenBuffer.LA(TokenBuffer.java:80)
19:58:59,637 ERROR [STDERR] at antlr.LLkParser.LA(LLkParser.java:52)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWh
enParser.value(ValidWhenParser.java:380)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWh
enParser.comparisonExpression(ValidWhenParser.java:434)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWh
enParser.expr(ValidWhenParser.java:415)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWh
enParser.joinedExpression(ValidWhenParser.java:446)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWh
enParser.expr(ValidWhenParser.java:420)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWh
enParser.expression(ValidWhenParser.java:406)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWh
en.validateValidWhen(ValidWhen.java:155)
19:58:59,637 ERROR [STDERR] at
sun.reflect.GeneratedMethodAccessor126.invoke
(Unknown Source)
19:58:59,637 ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invo
ke(DelegatingMethodAccessorImpl.java:25)
19:58:59,637 ERROR [STDERR] at
java.lang.reflect.Method.invoke(Method.java:3
24)
19:58:59,637 ERROR [STDERR] at
org.apache.commons.validator.ValidatorAction.
executeValidationMethod(ValidatorAction.java:610)
19:58:59,637 ERROR [STDERR] at
org.apache.commons.validator.Field.validateFo
rRule(Field.java:848)
19:58:59,637 ERROR [STDERR] at
org.apache.commons.validator.Field.validate(F
ield.java:927)
19:58:59,637 ERROR [STDERR] at
org.apache.commons.validator.Form.validate(Fo
rm.java:211)
19:58:59,637 ERROR [STDERR] at
org.apache.commons.validator.Validator.valida
te(Validator.java:407)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.validator.ValidatorForm.val
idate(ValidatorForm.java:151)
19:58:59,637 ERROR [STDERR] at
com.adobe.edc.server.presentation.fw.EDCActio
nForm.validate(EDCActionForm.java:96)
19:58:59,637 ERROR [STDERR] at
com.adobe.edc.server.presentation.policy.Assi
gnPermissionAction.addAnonymous_onClick(AssignPermissionAction.java:252)
19:58:59,637 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke0(
Native Method)
19:58:59,637 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke(N
ativeMethodAccessorImpl.java:39)
19:58:59,637 ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invo
ke(DelegatingMethodAccessorImpl.java:25)
19:58:59,637 ERROR [STDERR] at
java.lang.reflect.Method.invoke(Method.java:3
24)
19:58:59,637 ERROR [STDERR] at
com.cc.framework.adapter.struts.FWAction.hand
leFormAction(Unknown Source)
19:58:59,637 ERROR [STDERR] at
com.cc.framework.adapter.struts.FWAction.exec
ute(Unknown Source)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.action.RequestProcessor.pro
cessActionPerform(RequestProcessor.java:462)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.action.RequestProcessor.pro
cess(RequestProcessor.java:267)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.action.ActionServlet.proces
s(ActionServlet.java:1187)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.action.ActionServlet.doPost
(ActionServlet.java:451)
19:58:59,637 ERROR [STDERR] at
javax.servlet.http.HttpServlet.service(HttpSe
rvlet.java:760)
19:58:59,637 ERROR [STDERR] at
javax.servlet.http.HttpServlet.service(HttpSe
rvlet.java:853)
19:58:59,637 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterCha
in.internalDoFilter

RE: Struts Validator prints all javascript functions

2004-03-15 Thread Kunal H. Parikh
Hi Guys !

Does anyone think that this could be happening because I am using Tiles ?


Kunal

-Original Message-
From: Kunal H. Parikh [mailto:[EMAIL PROTECTED] 
Sent: Monday, 15 March 2004 10:12
To: 'Struts Users Mailing List'
Subject: RE: Struts Validator prints all javascript functions

I thought so too!

My struts-config.xml reads as follows
==
...
form-bean name=vehicleEnquiry
type=org.apache.struts.validator.DynaValidatorActionForm
form-property name=vehicleId
type=java.lang.Integer /
form-property name=fullName
type=java.lang.String /
/form-bean
...
=

Do you think DynaValidatorActionForm could be creating the problem ?


Kunal

-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Marino A. Jonsson
Sent: Monday, 15 March 2004 10:07
To: [EMAIL PROTECTED]
Subject: Re: Struts Validator prints all javascript functions

hmm ... that's not my experience - the dynamic parts are rendered as they
should, but all the static javascript is then rendered too (instead of just
the relevant static methods).  I haven't tested 1.2 though.

Marino

Joe Germuska [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 At 8:55 AM +1100 3/15/04, Kunal H. Parikh wrote:
 Hi All!
 
 I am attempting to use Struts Validator.
 
 All works well, but I am only using the required validation in my code.
 
 However, the JavaScript that gets generated, include other functions like
 checkEmail, minLength, etc. etc.
 
 Is this expected behaviour?

 This is what happens when the formName you specify in the
 html:javascript tag is not found by the validator.

 Since Struts 1.2.0 (and a little before in the nightlies, of course),
 this condition causes a JSPException to be thrown instead.

 Joe


 -- 
 Joe Germuska
 [EMAIL PROTECTED]
 http://blog.germuska.com
Imagine if every Thursday your shoes exploded if you tied them
 the usual way.  This happens to us all the time with computers, and
 nobody thinks of complaining.
  -- Jef Raskin




-
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: Struts Validator prints all javascript functions

2004-03-15 Thread Theodosios Paschalidis
Hi Kunal,

I do not use Tiles nor the DynaValidator but I get the same in a certain
Form. I use Struts 1.1

Theo

- Original Message - 
From: Kunal H. Parikh [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Monday, March 15, 2004 9:38 PM
Subject: RE: Struts Validator prints all javascript functions


Hi Guys !

Does anyone think that this could be happening because I am using Tiles ?


Kunal

-Original Message-
From: Kunal H. Parikh [mailto:[EMAIL PROTECTED]
Sent: Monday, 15 March 2004 10:12
To: 'Struts Users Mailing List'
Subject: RE: Struts Validator prints all javascript functions

I thought so too!

My struts-config.xml reads as follows
==
..
form-bean name=vehicleEnquiry
type=org.apache.struts.validator.DynaValidatorActionForm
form-property name=vehicleId
type=java.lang.Integer /
form-property name=fullName
type=java.lang.String /
/form-bean
..
=

Do you think DynaValidatorActionForm could be creating the problem ?


Kunal

-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Marino A. Jonsson
Sent: Monday, 15 March 2004 10:07
To: [EMAIL PROTECTED]
Subject: Re: Struts Validator prints all javascript functions

hmm ... that's not my experience - the dynamic parts are rendered as they
should, but all the static javascript is then rendered too (instead of just
the relevant static methods).  I haven't tested 1.2 though.

Marino

Joe Germuska [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 At 8:55 AM +1100 3/15/04, Kunal H. Parikh wrote:
 Hi All!
 
 I am attempting to use Struts Validator.
 
 All works well, but I am only using the required validation in my code.
 
 However, the JavaScript that gets generated, include other functions like
 checkEmail, minLength, etc. etc.
 
 Is this expected behaviour?

 This is what happens when the formName you specify in the
 html:javascript tag is not found by the validator.

 Since Struts 1.2.0 (and a little before in the nightlies, of course),
 this condition causes a JSPException to be thrown instead.

 Joe


 -- 
 Joe Germuska
 [EMAIL PROTECTED]
 http://blog.germuska.com
Imagine if every Thursday your shoes exploded if you tied them
 the usual way.  This happens to us all the time with computers, and
 nobody thinks of complaining.
  -- Jef Raskin




-
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: Newbie needs help: Validator not working with Struts/Velocity

2004-03-14 Thread Marino A. Jonsson
I see nothing wrong - the actions look fine and #errorMarkup() should take
care of displaying any form errors.  Did you model this after the validator
example in the velstruts appliction that comes with Velocity Tools 1.1-rc1?

cheers,
Marinó

[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I'm fairly new to Struts, and have been trying to get my simple
 application to work - using Struts 1.1, Velocity 1.3.1, Velocity
 Tools 1.1-rc1, and Tomcat 4.1.29. The application (such as it is)
 works as far as presentation and workflow - but _isn't_ working is
 the Validator framework. I've spent the last day mining the web for
 help and haven't been able to progress at all...

 The validator files _are_ being loaded - I see them in the log
 files. And the rules/formset are being parsed - again, I see it in
 the log. However, when the form is submitted on the first page
 (payment.vm) and it goes to the second...no validation takes place.
 No errors are appearing in either the catalina.out or localhost
 log file. I have kicked up the log level to trace and still see
 nothing wrong - other than the validation doesn't seem to happen.

 Any help or suggestions would be GREATLY appreciated - I'm rather
 stuck at the moment. I'm sure its just some silly configuration
 or other error...

 I'm including all the relevant files inline below.

 Thank you very much

   Andy Akins

 == web.xml

 ?xml version=1.0 encoding=ISO-8859-1?
 !DOCTYPE web-app
   PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN
   http://java.sun.com/j2ee/dtds/web-app_2_2.dtd;
 web-app
   display-nameCCPAY/display-name
   servlet
 servlet-nameaction/servlet-name
 servlet-classorg.apache.struts.action.ActionServlet/servlet-class
 init-param
   param-nameconfig/param-name
   param-value/WEB-INF/struts-config.xml/param-value
 /init-param
 init-param
   param-namedebug/param-name
   param-value2/param-value
 /init-param
 init-param
   param-namedetail/param-name
   param-value2/param-value
 /init-param
 init-param
   param-namevalidate/param-name
   param-valuetrue/param-value
 /init-param
 load-on-startup2/load-on-startup
   /servlet
   servlet
 servlet-namevelocity/servlet-name

servlet-classorg.apache.velocity.tools.view.servlet.VelocityViewServlet/s
ervlet-class
 init-param
   param-nameorg.apache.velocity.toolbox/param-name
   param-value/WEB-INF/toolbox.xml/param-value
 /init-param
 init-param
   param-nameorg.apache.velocity.properties/param-name
   param-value/WEB-INF/velocity.properties/param-value
/init-param
load-on-startup10/load-on-startup
   /servlet
   servlet-mapping
 servlet-nameaction/servlet-name
 url-pattern*.do/url-pattern
   /servlet-mapping
   servlet-mapping
 servlet-namevelocity/servlet-name
 url-pattern*.vm/url-pattern
   /servlet-mapping
   welcome-file-list
 welcome-fileindex.html/welcome-file
   /welcome-file-list
 /web-app

 = struts-config.xml
 ?xml version=1.0 encoding=ISO-8859-1 ?
 !DOCTYPE struts-config PUBLIC
   -//Apache Software Foundation//DTD Struts Configuration
1.1//EN
   http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd;
 struts-config
   form-beans
 form-bean name=paymentForm
type=org.apache.struts.validator.DynaValidatorForm
   form-property name=amount type=java.lang.String initial=boo
/
 /form-bean
   /form-beans
   action-mappings
 action path=/Payment
   type=org.apache.struts.actions.ForwardAction
   name=paymentForm
   validate=false
   parameter=/payment.vm/
 action path=/Processing
   type=org.apache.struts.actions.ForwardAction
   name=paymentForm
   input=/Payment.do
   validate=true
   parameter=/processing.vm/
   /action-mappings
   message-resources parameter=application /
   plug-in className=org.apache.struts.validator.ValidatorPlugIn
 set-property property=pathnames
   value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/
   /plug-in
 /struts-config

 = validation.xml - I'm using the standard validate-rules.xml
 ?xml version=1.0 encoding=ISO-8859-1 ?
 !DOCTYPE form-validation PUBLIC
   -//Apache Software Foundation//DTD Commons Validator Rules
Configuration 1.0//EN
   http://jakarta.apache.org/commons/dtds/validator_1_0.dtd;
 form-validation
   formset
 form name=paymentForm
   field property=amount
 depends=required,email
 msg name=email key=errors.invalid/
 arg0 key=paymentForm.label.amount /
   /field
 /form
   /formset
 /form-validation

 = Toolbox.xml
 ?xml version=1.0?

 toolbox
   tool
  keylink/key
  classorg.apache.velocity.tools.struts.StrutsLinkTool/class
   /tool
   tool
  keyslink/key
  classorg.apache.velocity.tools.struts.SecureLinkTool/class
   /tool
   tool
  keytext/key
  classorg.apache.velocity.tools.struts.MessageTool/class
   /tool
   tool

Struts Validator prints all javascript functions

2004-03-14 Thread Kunal H. Parikh
Hi All!

I am attempting to use Struts Validator.

All works well, but I am only using the required validation in my code.

However, the JavaScript that gets generated, include other functions like
checkEmail, minLength, etc. etc.

Is this expected behaviour?

My code (FYI):
===
html:form name=vehicleEnquiry action=/vehicleEnquiry.do method=post
type=org.apache.struts.validator.DynaValidatorActionForm onsubmit=return(
validateVehicleEnquiry(this) );  



tr
tdbean:message key=label.name /:/td
td html:text property=name value= / /td
/tr


html:submit value=Send Enquiry /
/html:form
html:javascript formName=vehicleEnquiry /
==

TIA,

Kunal



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



Re: Struts Validator prints all javascript functions

2004-03-14 Thread Joe Germuska
At 8:55 AM +1100 3/15/04, Kunal H. Parikh wrote:
Hi All!

I am attempting to use Struts Validator.

All works well, but I am only using the required validation in my code.

However, the JavaScript that gets generated, include other functions like
checkEmail, minLength, etc. etc.
Is this expected behaviour?
This is what happens when the formName you specify in the 
html:javascript tag is not found by the validator.

Since Struts 1.2.0 (and a little before in the nightlies, of course), 
this condition causes a JSPException to be thrown instead.

Joe

--
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
  Imagine if every Thursday your shoes exploded if you tied them 
the usual way.  This happens to us all the time with computers, and 
nobody thinks of complaining.
-- Jef Raskin

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


Re: Struts Validator prints all javascript functions

2004-03-14 Thread Marino A. Jonsson
hmm ... that's not my experience - the dynamic parts are rendered as they
should, but all the static javascript is then rendered too (instead of just
the relevant static methods).  I haven't tested 1.2 though.

Marino

Joe Germuska [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 At 8:55 AM +1100 3/15/04, Kunal H. Parikh wrote:
 Hi All!
 
 I am attempting to use Struts Validator.
 
 All works well, but I am only using the required validation in my code.
 
 However, the JavaScript that gets generated, include other functions like
 checkEmail, minLength, etc. etc.
 
 Is this expected behaviour?

 This is what happens when the formName you specify in the
 html:javascript tag is not found by the validator.

 Since Struts 1.2.0 (and a little before in the nightlies, of course),
 this condition causes a JSPException to be thrown instead.

 Joe


 -- 
 Joe Germuska
 [EMAIL PROTECTED]
 http://blog.germuska.com
Imagine if every Thursday your shoes exploded if you tied them
 the usual way.  This happens to us all the time with computers, and
 nobody thinks of complaining.
  -- Jef Raskin




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



RE: Struts Validator prints all javascript functions

2004-03-14 Thread Kunal H. Parikh
I thought so too!

My struts-config.xml reads as follows
==
...
form-bean name=vehicleEnquiry
type=org.apache.struts.validator.DynaValidatorActionForm
form-property name=vehicleId
type=java.lang.Integer /
form-property name=fullName
type=java.lang.String /
/form-bean
...
=

Do you think DynaValidatorActionForm could be creating the problem ?


Kunal

-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Marino A. Jonsson
Sent: Monday, 15 March 2004 10:07
To: [EMAIL PROTECTED]
Subject: Re: Struts Validator prints all javascript functions

hmm ... that's not my experience - the dynamic parts are rendered as they
should, but all the static javascript is then rendered too (instead of just
the relevant static methods).  I haven't tested 1.2 though.

Marino

Joe Germuska [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 At 8:55 AM +1100 3/15/04, Kunal H. Parikh wrote:
 Hi All!
 
 I am attempting to use Struts Validator.
 
 All works well, but I am only using the required validation in my code.
 
 However, the JavaScript that gets generated, include other functions like
 checkEmail, minLength, etc. etc.
 
 Is this expected behaviour?

 This is what happens when the formName you specify in the
 html:javascript tag is not found by the validator.

 Since Struts 1.2.0 (and a little before in the nightlies, of course),
 this condition causes a JSPException to be thrown instead.

 Joe


 -- 
 Joe Germuska
 [EMAIL PROTECTED]
 http://blog.germuska.com
Imagine if every Thursday your shoes exploded if you tied them
 the usual way.  This happens to us all the time with computers, and
 nobody thinks of complaining.
  -- Jef Raskin




-
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: Newbie needs help: Validator not working with Struts/Velocity

2004-03-11 Thread Niall Pemberton
You say No errors are appearing in either the catalina.out or localhost log
file - I don't think validator logs anything to those places and saying
that makes me think what are you expecting to happen when validation
fails.

The normal course of events when validation fails is struts saves an
ActionErrors object in the request under a certain key
(org.apache.struts.action.ERROR) and forwards to the input parameter
defined for your action.

If you were using jsps you would then probably use the html:errors tag
which processes the stored ActionErrors and displays the error messages to
the user - I don't know velocity but presumably you could do something
similar.

Looking at your struts-config.xml, its your /Processing action which you are
expecting to validate - its input attribute is /Payment.do - this action
forwards to your velocity stuff /payment.vm - is there anything in
/payment.vm which displays the ActionErrors? To be honest your action
looks to be configured the wrong way round, I would have expected:

action path=/Processing
  type=org.apache.struts.actions.ForwardAction
  name=paymentForm
  input=/processing.vm
  validate=true
  parameter=/Payment.do/

How about setting up a validation errors page in velocity and changing
your input parameter - that way if you get an validation error you should
see a different page. Something like...

action path=/Processing
  type=org.apache.struts.actions.ForwardAction
  name=paymentForm
  input=/paymentErrors.vm
  validate=true
  parameter=/Payment.do/

Niall

- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, March 10, 2004 5:54 PM
Subject: Newbie needs help: Validator not working with Struts/Velocity


I'm fairly new to Struts, and have been trying to get my simple
application to work - using Struts 1.1, Velocity 1.3.1, Velocity
Tools 1.1-rc1, and Tomcat 4.1.29. The application (such as it is)
works as far as presentation and workflow - but _isn't_ working is
the Validator framework. I've spent the last day mining the web for
help and haven't been able to progress at all...

The validator files _are_ being loaded - I see them in the log
files. And the rules/formset are being parsed - again, I see it in
the log. However, when the form is submitted on the first page
(payment.vm) and it goes to the second...no validation takes place.
No errors are appearing in either the catalina.out or localhost
log file. I have kicked up the log level to trace and still see
nothing wrong - other than the validation doesn't seem to happen.

Any help or suggestions would be GREATLY appreciated - I'm rather
stuck at the moment. I'm sure its just some silly configuration
or other error...

I'm including all the relevant files inline below.

Thank you very much

  Andy Akins

== web.xml

?xml version=1.0 encoding=ISO-8859-1?
!DOCTYPE web-app
  PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN
  http://java.sun.com/j2ee/dtds/web-app_2_2.dtd;
web-app
  display-nameCCPAY/display-name
  servlet
servlet-nameaction/servlet-name
servlet-classorg.apache.struts.action.ActionServlet/servlet-class
init-param
  param-nameconfig/param-name
  param-value/WEB-INF/struts-config.xml/param-value
/init-param
init-param
  param-namedebug/param-name
  param-value2/param-value
/init-param
init-param
  param-namedetail/param-name
  param-value2/param-value
/init-param
init-param
  param-namevalidate/param-name
  param-valuetrue/param-value
/init-param
load-on-startup2/load-on-startup
  /servlet
  servlet
servlet-namevelocity/servlet-name

servlet-classorg.apache.velocity.tools.view.servlet.VelocityViewServlet/s
ervlet-class
init-param
  param-nameorg.apache.velocity.toolbox/param-name
  param-value/WEB-INF/toolbox.xml/param-value
/init-param
init-param
  param-nameorg.apache.velocity.properties/param-name
  param-value/WEB-INF/velocity.properties/param-value
   /init-param
   load-on-startup10/load-on-startup
  /servlet
  servlet-mapping
servlet-nameaction/servlet-name
url-pattern*.do/url-pattern
  /servlet-mapping
  servlet-mapping
servlet-namevelocity/servlet-name
url-pattern*.vm/url-pattern
  /servlet-mapping
  welcome-file-list
welcome-fileindex.html/welcome-file
  /welcome-file-list
/web-app

= struts-config.xml
?xml version=1.0 encoding=ISO-8859-1 ?
!DOCTYPE struts-config PUBLIC
  -//Apache Software Foundation//DTD Struts Configuration 1.1//EN
  http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd;
struts-config
  form-beans
form-bean name=paymentForm
type=org.apache.struts.validator.DynaValidatorForm
  form-property name=amount type=java.lang.String initial=boo /
/form-bean
  /form-beans
  action-mappings
action path=/Payment
  type=org.apache.struts.actions.ForwardAction
  name=paymentForm
  validate=false

Regarding Error in Validator - Urgent Help

2004-03-10 Thread Ramachandran
Hi Friends,

I am using the validator to perform the validations. I am facing the error
while perform such operations. Can anyone please help me regarding this one.

I am having FirstForm conatins phone and email. For that i am
performing the validation using validator.

Please suugest me..



This is the error
Location: /ram1.1/first.jsp
Internal Servlet Error:

javax.servlet.ServletException
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:399)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:536)

Root cause:
java.lang.ExceptionInInitializerError
at
_0002ffirst_0002ejspfirst_jsp_0._jspService(_0002ffirst_0002ejspfirst_jsp_0.
java:63)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:536)
Caused by: java.lang.NullPointerException
at
org.apache.struts.util.MessageResources.getMessageResources(MessageResources
.java:577)
at org.apache.struts.taglib.html.HtmlTag.(HtmlTag.java:96)
... 16 more



This is my FormBean

package com.summit;

import java.io.Serializable;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionError;
import org.apache.struts.validator.ValidatorForm;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;


public final class FirstForm extends ValidatorForm implements Serializable
{
private String sPhone = null;
private String sEmail = null;
public String getPhone() {return sPhone;}
public void setPhone(String sPhone) {this.sPhone = sPhone;}
public String getEmail() {return sEmail;}
public void setEmail(String sEmail) {this.sEmail = sEmail;}

public ActionErrors validate(
ActionMapping mapping,
HttpServletRequest request) {
return super.validate(mapping, request);
}
}

This is my Struts-Config File

!DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts
Configuration 1.0//EN
http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd;
struts-config

form-beans type=org.apache.struts.action.ActionFormBean
 form-bean  name=firstForm type=com.summit.FirstForm/
/form-beans

action-mappings type=org.apache.struts.action.ActionMapping
action path=/first type= com.summit.FirstAction
  name=firstForm scope=request  validate=true
forward name=success  path=/second.jsp/
/action
/action-mappings

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

/struts-config


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



Re: Regarding Error in Validator - Urgent Help

2004-03-10 Thread Geeta Ramani
Hi Ramachandran:

Here's a suggestion: look at line number 63 of the servlet (in your work directory)
generated by your first.jsp.  See what the code there is and that may give you an idea
of what's going wrong.. (seems like a null pointer somewhere, so try to see what may be
null in that line of code ..)

Regards,
Geeta

Ramachandran wrote:



 Root cause:
 java.lang.ExceptionInInitializerError
 at
 _0002ffirst_0002ejspfirst_jsp_0._jspService(_0002ffirst_0002ejspfirst_jsp_0.
 java:63)


 Caused by: java.lang.NullPointerException
 at
 org.apache.struts.util.MessageResources.getMessageResources(MessageResources
 .java:577)
 at org.apache.struts.taglib.html.HtmlTag.(HtmlTag.java:96)
 ... 16 more




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



Newbie needs help: Validator not working with Struts/Velocity

2004-03-10 Thread andy
I'm fairly new to Struts, and have been trying to get my simple 
application to work - using Struts 1.1, Velocity 1.3.1, Velocity 
Tools 1.1-rc1, and Tomcat 4.1.29. The application (such as it is)
works as far as presentation and workflow - but _isn't_ working is
the Validator framework. I've spent the last day mining the web for
help and haven't been able to progress at all...

The validator files _are_ being loaded - I see them in the log
files. And the rules/formset are being parsed - again, I see it in
the log. However, when the form is submitted on the first page
(payment.vm) and it goes to the second...no validation takes place.
No errors are appearing in either the catalina.out or localhost
log file. I have kicked up the log level to trace and still see
nothing wrong - other than the validation doesn't seem to happen.

Any help or suggestions would be GREATLY appreciated - I'm rather
stuck at the moment. I'm sure its just some silly configuration
or other error...

I'm including all the relevant files inline below. 

Thank you very much

  Andy Akins
  
== web.xml

?xml version=1.0 encoding=ISO-8859-1?
!DOCTYPE web-app
  PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN
  http://java.sun.com/j2ee/dtds/web-app_2_2.dtd;
web-app
  display-nameCCPAY/display-name  
  servlet
servlet-nameaction/servlet-name
servlet-classorg.apache.struts.action.ActionServlet/servlet-class
init-param
  param-nameconfig/param-name
  param-value/WEB-INF/struts-config.xml/param-value
/init-param
init-param
  param-namedebug/param-name
  param-value2/param-value
/init-param
init-param
  param-namedetail/param-name
  param-value2/param-value
/init-param
init-param
  param-namevalidate/param-name
  param-valuetrue/param-value
/init-param
load-on-startup2/load-on-startup
  /servlet
  servlet
servlet-namevelocity/servlet-name

servlet-classorg.apache.velocity.tools.view.servlet.VelocityViewServlet/servlet-class
init-param
  param-nameorg.apache.velocity.toolbox/param-name
  param-value/WEB-INF/toolbox.xml/param-value
/init-param
init-param
  param-nameorg.apache.velocity.properties/param-name
  param-value/WEB-INF/velocity.properties/param-value
   /init-param
   load-on-startup10/load-on-startup
  /servlet
  servlet-mapping
servlet-nameaction/servlet-name
url-pattern*.do/url-pattern
  /servlet-mapping
  servlet-mapping
servlet-namevelocity/servlet-name
url-pattern*.vm/url-pattern
  /servlet-mapping
  welcome-file-list
welcome-fileindex.html/welcome-file
  /welcome-file-list
/web-app

= struts-config.xml
?xml version=1.0 encoding=ISO-8859-1 ?
!DOCTYPE struts-config PUBLIC
  -//Apache Software Foundation//DTD Struts Configuration 1.1//EN
  http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd;
struts-config
  form-beans
form-bean name=paymentForm type=org.apache.struts.validator.DynaValidatorForm
  form-property name=amount type=java.lang.String initial=boo /
/form-bean
  /form-beans
  action-mappings
action path=/Payment
  type=org.apache.struts.actions.ForwardAction
  name=paymentForm
  validate=false
  parameter=/payment.vm/
action path=/Processing
  type=org.apache.struts.actions.ForwardAction
  name=paymentForm
  input=/Payment.do
  validate=true
  parameter=/processing.vm/
  /action-mappings
  message-resources parameter=application /
  plug-in className=org.apache.struts.validator.ValidatorPlugIn
set-property property=pathnames
  value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/
  /plug-in
/struts-config

= validation.xml - I'm using the standard validate-rules.xml
?xml version=1.0 encoding=ISO-8859-1 ?
!DOCTYPE form-validation PUBLIC
  -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN
  http://jakarta.apache.org/commons/dtds/validator_1_0.dtd;
form-validation
  formset
form name=paymentForm
  field property=amount
depends=required,email
msg name=email key=errors.invalid/
arg0 key=paymentForm.label.amount /
  /field
/form
  /formset
/form-validation

= Toolbox.xml
?xml version=1.0?

toolbox
  tool
 keylink/key
 classorg.apache.velocity.tools.struts.StrutsLinkTool/class
  /tool
  tool
 keyslink/key
 classorg.apache.velocity.tools.struts.SecureLinkTool/class
  /tool
  tool
 keytext/key
 classorg.apache.velocity.tools.struts.MessageTool/class
  /tool
  tool
 keyerrors/key
 classorg.apache.velocity.tools.struts.ErrorsTool/class
  /tool
  tool
 keymessages/key
 classorg.apache.velocity.tools.struts.ActionMessagesTool/class
  /tool
  tool
 keyform/key
 classorg.apache.velocity.tools.struts.FormTool/class
  /tool
  tool
 keytiles/key
 classorg.apache.velocity.tools.struts.TilesTool/class
  /tool
  tool
 keyvalidator/key

Re: Newbie needs help: Validator not working with Struts/Velocity

2004-03-10 Thread Markus
 I'm fairly new to Struts, and have been trying to get my simple 
 application to work - using Struts 1.1, Velocity 1.3.1, Velocity 
 Tools 1.1-rc1, and Tomcat 4.1.29. The application (such as it is)
 works as far as presentation and workflow - but _isn't_ working is
 the Validator framework. I've spent the last day mining the web for
 help and haven't been able to progress at all...
 
 The validator files _are_ being loaded - I see them in the log
 files. And the rules/formset are being parsed - again, I see it in
 the log. However, when the form is submitted on the first page
 (payment.vm) and it goes to the second...no validation takes place.
 No errors are appearing in either the catalina.out or localhost
 log file. I have kicked up the log level to trace and still see
 nothing wrong - other than the validation doesn't seem to happen.
 
 Any help or suggestions would be GREATLY appreciated - I'm rather
 stuck at the moment. I'm sure its just some silly configuration
 or other error...
 
 I'm including all the relevant files inline below. 
 
 Thank you very much
 
   Andy Akins
   
 == web.xml
 
 ?xml version=1.0 encoding=ISO-8859-1?
 !DOCTYPE web-app
   PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN
   http://java.sun.com/j2ee/dtds/web-app_2_2.dtd;
 web-app
   display-nameCCPAY/display-name  
   servlet
 servlet-nameaction/servlet-name
 servlet-classorg.apache.struts.action.ActionServlet/servlet-class
 init-param
   param-nameconfig/param-name
   param-value/WEB-INF/struts-config.xml/param-value
 /init-param
 init-param
   param-namedebug/param-name
   param-value2/param-value
 /init-param
 init-param
   param-namedetail/param-name
   param-value2/param-value
 /init-param
 init-param
   param-namevalidate/param-name
   param-valuetrue/param-value
 /init-param
 load-on-startup2/load-on-startup
   /servlet
   servlet
 servlet-namevelocity/servlet-name
   


servlet-classorg.apache.velocity.tools.view.servlet.VelocityViewServlet/servlet-class
 init-param
   param-nameorg.apache.velocity.toolbox/param-name
   param-value/WEB-INF/toolbox.xml/param-value
 /init-param
 init-param
   param-nameorg.apache.velocity.properties/param-name
   param-value/WEB-INF/velocity.properties/param-value
/init-param
load-on-startup10/load-on-startup
   /servlet
   servlet-mapping
 servlet-nameaction/servlet-name
 url-pattern*.do/url-pattern
   /servlet-mapping
   servlet-mapping
 servlet-namevelocity/servlet-name
 url-pattern*.vm/url-pattern
   /servlet-mapping
   welcome-file-list
 welcome-fileindex.html/welcome-file
   /welcome-file-list
 /web-app
 
 = struts-config.xml
 ?xml version=1.0 encoding=ISO-8859-1 ?
 !DOCTYPE struts-config PUBLIC
   -//Apache Software Foundation//DTD Struts Configuration
 1.1//EN
   http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd;
 struts-config
   form-beans
 form-bean name=paymentForm
 type=org.apache.struts.validator.DynaValidatorForm
   form-property name=amount type=java.lang.String initial=boo
 /
 /form-bean
   /form-beans
   action-mappings
 action path=/Payment
   type=org.apache.struts.actions.ForwardAction
   name=paymentForm
   validate=false
   parameter=/payment.vm/
 action path=/Processing
   type=org.apache.struts.actions.ForwardAction
Hi,
Are you sure that the action is right?
I can't belive!
Kind regarrds,
Markus



   name=paymentForm
   input=/Payment.do
   validate=true
   parameter=/processing.vm/
   /action-mappings
   message-resources parameter=application /
   plug-in className=org.apache.struts.validator.ValidatorPlugIn
 set-property property=pathnames
   value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/
   /plug-in
 /struts-config
 
 = validation.xml - I'm using the standard validate-rules.xml
 ?xml version=1.0 encoding=ISO-8859-1 ?
 !DOCTYPE form-validation PUBLIC
   -//Apache Software Foundation//DTD Commons Validator Rules
 Configuration 1.0//EN
   http://jakarta.apache.org/commons/dtds/validator_1_0.dtd;
 form-validation
   formset
 form name=paymentForm
   field property=amount
 depends=required,email
 msg name=email key=errors.invalid/
 arg0 key=paymentForm.label.amount /
   /field
 /form
   /formset
 /form-validation
 
 = Toolbox.xml
 ?xml version=1.0?
 
 toolbox
   tool
  keylink/key
  classorg.apache.velocity.tools.struts.StrutsLinkTool/class
   /tool
   tool
  keyslink/key
  classorg.apache.velocity.tools.struts.SecureLinkTool/class
   /tool
   tool
  keytext/key
  classorg.apache.velocity.tools.struts.MessageTool/class
   /tool
   tool
  keyerrors/key
  classorg.apache.velocity.tools.struts.ErrorsTool/class
   /tool
   tool
  keymessages/key
  classorg.apache.velocity.tools.struts.ActionMessagesTool/class

validator framework / multibox and javascript validation

2004-03-09 Thread harm
Hi all,

I have want to validate (client-side using javascript generated by the 
validator framework) if my user has at least selected one checkbox in my 
html:multibox form item.

Unfortunatly the javascript generator does not generate the JavaScript 
needed to validate this. 

I read somewhere on the mailinglist archive that this is a known issue 
with struts 1.1. The advice was to upgrade using a nightly build.
I tried to do so, but unfortunatly this does not work with the Tiles 
framework (which I'm also using in my application).

Can somebody tell me how to get this validation work?

Below provided my code:

I have a simple validator form:

public class SimpleForm extends ValidatorForm {
private String[] selectedItems;
 
public String[] getSelectedItems() {
return selectedItems;
}

public void setSelectedItems(String[] items) {
this.selectedItems = items;
}
}

And the following rule in validation.xml:

formset
  form name=simpleForm
  field property=selectedItems
 depends=required

  arg0 key=simpleForm.selectedItems/
  /field
  /form
/formset

I have the following JSP:

html:javascript formName=autoForm onsubmit=return 
validateSimpleForm(this);/
html:form action=/test
html:multibox property=selectedItems
bean:write name=car property=id/
/html:multibox
/html:form

Thanks,

Regards,

Harm de Laat
Informatiefabriek
The Netherlands

Regarding Error in Validator

2004-03-09 Thread Ramachandran
Hi Friends,

I am using the validator to perform the validations. I am facing the error
while perform such operations. Can anyone please help me regarding this one.

I am having LoginForm conatins username and password. For that i am
performing the validation using validator.

Please suugest me..


This is the error

Error: 500
Location: /ecgv1.2/login.jsp
Internal Servlet Error:

javax.servlet.ServletException: (class:
org/apache/struts/validator/ValidatorForm, method: validate signature:
(Lorg/apache/struts/action/ActionMapping;Ljavax/servlet/http/HttpServletRequ
est;)Lorg/apache/struts/action/ActionErrors;) Incompatible object argument
for function call
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:399)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:536)

Root cause:
java.lang.VerifyError: (class: org/apache/struts/validator/ValidatorForm,
method: validate signature:
(Lorg/apache/struts/action/ActionMapping;Ljavax/servlet/http/HttpServletRequ
est;)Lorg/apache/struts/action/ActionErrors;) Incompatible object argument
for function call
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)
at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:563)
at
_0002flogin_0002ejsplogin_jsp_0._jspService(_0002flogin_0002ejsplogin_jsp_0.
java:118)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:536)


Thanks N Regds

M.Ramachandran
SummitWorks Technologies Pvt Ltd
Voice : 28478601 X 123
www.summitworks.com
[EMAIL PROTECTED]


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



Struts Validator

2004-03-08 Thread Ramachandran
Can any one please send me the URL of where struts validator files are. I
want to use the validator in my project. So i am in the need pf such class
files...

Thanx,
Ram


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



Validator classes and validator-rules.xml

2004-03-08 Thread Chris Searle

I'm getting an odd exception:

2004-03-08 11:19:41,405 ERROR [org.apache.commons.validator.Validator] reflection: 
org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, 
org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, 
org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest)
java.lang.NoSuchMethodException: 
org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, 
org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, 
org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest)
   at java.lang.Class.getMethod(Class.java:978)
at 
org.apache.commons.validator.Validator.executeValidationMethod(Validator.java:501)
at 
org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:424)
at org.apache.commons.validator.Validator.validateField(Validator.java:669)
at org.apache.commons.validator.Validator.validate(Validator.java:745)
at 
org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.java:150)

The parameter list shown in the NoSuchMethodException appears to match
the validator-rules.xml file:

 validator name=required
classname=org.apache.struts.validator.FieldChecks
   method=validateRequired
 methodParams=java.lang.Object,
   org.apache.commons.validator.ValidatorAction,
   org.apache.commons.validator.Field,
   org.apache.struts.action.ActionMessages,
   javax.servlet.http.HttpServletRequest
  msg=errors.required/

apart from the fourth parameter (ActionMessages vs ActionErrors) but
this is probably OK since ActionErrors is a subclass of
ActionMessages.

This parameter list also matches the javadoc.

NB: This is the Nightly Build binary download !!! I can't recall why -
just that I had a bug in the stable build that was fixed in the
nightly's. However - I've just changed from the old nightly to
20040306 (20040307 seems to be 163 bytes long) to test - and the same
problem with validation occurs.

Any hints anyone?

-- 
Chris Searle
[EMAIL PROTECTED]


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



Re: Struts Validator

2004-03-08 Thread Niall Pemberton
They are in two places, the struts specific validator files are in the
struts.jar - but validator is a commons component and its class files are in
commons-validator.jar.

Everything is shipped with the struts binary - look in the lib folder.

- Original Message - 
From: Ramachandran [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Monday, March 08, 2004 9:43 AM
Subject: Struts Validator


 Can any one please send me the URL of where struts validator files are. I
 want to use the validator in my project. So i am in the need pf such class
 files...

 Thanx,
 Ram


 -
 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: Validator classes and validator-rules.xml

2004-03-08 Thread Adam Hardy
On 03/08/2004 12:02 PM Chris Searle wrote:
I'm getting an odd exception:

2004-03-08 11:19:41,405 ERROR [org.apache.commons.validator.Validator] reflection: 
org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, 
org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, 
org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest)
java.lang.NoSuchMethodException: 
org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, 
org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, 
org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest)
   at java.lang.Class.getMethod(Class.java:978)
at 
org.apache.commons.validator.Validator.executeValidationMethod(Validator.java:501)
at 
org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:424)
at org.apache.commons.validator.Validator.validateField(Validator.java:669)
at org.apache.commons.validator.Validator.validate(Validator.java:745)
at 
org.apache.struts.validator.DynaValidatorForm.validate(DynaValidatorForm.java:150)
The parameter list shown in the NoSuchMethodException appears to match
the validator-rules.xml file:
 validator name=required
classname=org.apache.struts.validator.FieldChecks
   method=validateRequired
 methodParams=java.lang.Object,
   org.apache.commons.validator.ValidatorAction,
   org.apache.commons.validator.Field,
   org.apache.struts.action.ActionMessages,
   javax.servlet.http.HttpServletRequest
  msg=errors.required/
apart from the fourth parameter (ActionMessages vs ActionErrors) but
this is probably OK since ActionErrors is a subclass of
ActionMessages.
This parameter list also matches the javadoc.

NB: This is the Nightly Build binary download !!! I can't recall why -
just that I had a bug in the stable build that was fixed in the
nightly's. However - I've just changed from the old nightly to
20040306 (20040307 seems to be 163 bytes long) to test - and the same
problem with validation occurs.
I think I might have had this and found that changing to ActionMessages 
did solve it, even though it seems unnecessary.  This was one of last 
week's builds. I don't think that reflection process takes inheritance 
into account.
Adam
--
struts 1.1 + tomcat 5.0.16 + java 1.4.2
Linux 2.4.20 Debian

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


validator validwhen error

2004-03-08 Thread Betty Koon
Hi,

I got the following validator error, but not sure why.

here is my validator.xml and the exception:

formset
form name=someForm 
field
property=email
depends=validwhen,email
arg0 key=email.error_label/
var
var-nametest/var-name
var-value((actionType != 'x') or (*this* !=
null))/var-value
/var 
/field 
field
property=startDate
depends=validwhen,date
arg0 key=start_date.error_label/
var
var-nametest/var-name
var-value((editAction != 'false') or (*this* !=
null))/var-value
/var
var
var-namedatePatternStrict/var-name
var-valueMM/dd/ HH:mm:ss/var-value
/var
/field
/form
/formset






*
59:03,863 ERROR [STDERR] line 1:23: expecting ''', found '_'
59:03,863 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWh
exer.nextToken(ValidWhenLexer.java:228)
19:58:59,637 ERROR [STDERR] at
antlr.TokenBuffer.fill(TokenBuffer.java:69)
19:58:59,637 ERROR [STDERR] at antlr.TokenBuffer.LA(TokenBuffer.java:80)
19:58:59,637 ERROR [STDERR] at antlr.LLkParser.LA(LLkParser.java:52)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWh
enParser.value(ValidWhenParser.java:380)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWh
enParser.comparisonExpression(ValidWhenParser.java:434)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWh
enParser.expr(ValidWhenParser.java:415)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWh
enParser.joinedExpression(ValidWhenParser.java:446)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWh
enParser.expr(ValidWhenParser.java:420)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWh
enParser.expression(ValidWhenParser.java:406)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.validator.validwhen.ValidWh
en.validateValidWhen(ValidWhen.java:155)
19:58:59,637 ERROR [STDERR] at
sun.reflect.GeneratedMethodAccessor126.invoke
(Unknown Source)
19:58:59,637 ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invo
ke(DelegatingMethodAccessorImpl.java:25)
19:58:59,637 ERROR [STDERR] at
java.lang.reflect.Method.invoke(Method.java:3
24)
19:58:59,637 ERROR [STDERR] at
org.apache.commons.validator.ValidatorAction.
executeValidationMethod(ValidatorAction.java:610)
19:58:59,637 ERROR [STDERR] at
org.apache.commons.validator.Field.validateFo
rRule(Field.java:848)
19:58:59,637 ERROR [STDERR] at
org.apache.commons.validator.Field.validate(F
ield.java:927)
19:58:59,637 ERROR [STDERR] at
org.apache.commons.validator.Form.validate(Fo
rm.java:211)
19:58:59,637 ERROR [STDERR] at
org.apache.commons.validator.Validator.valida
te(Validator.java:407)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.validator.ValidatorForm.val
idate(ValidatorForm.java:151)
19:58:59,637 ERROR [STDERR] at
com.adobe.edc.server.presentation.fw.EDCActio
nForm.validate(EDCActionForm.java:96)
19:58:59,637 ERROR [STDERR] at
com.adobe.edc.server.presentation.policy.Assi
gnPermissionAction.addAnonymous_onClick(AssignPermissionAction.java:252)
19:58:59,637 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke0(
Native Method)
19:58:59,637 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke(N
ativeMethodAccessorImpl.java:39)
19:58:59,637 ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invo
ke(DelegatingMethodAccessorImpl.java:25)
19:58:59,637 ERROR [STDERR] at
java.lang.reflect.Method.invoke(Method.java:3
24)
19:58:59,637 ERROR [STDERR] at
com.cc.framework.adapter.struts.FWAction.hand
leFormAction(Unknown Source)
19:58:59,637 ERROR [STDERR] at
com.cc.framework.adapter.struts.FWAction.exec
ute(Unknown Source)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.action.RequestProcessor.pro
cessActionPerform(RequestProcessor.java:462)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.action.RequestProcessor.pro
cess(RequestProcessor.java:267)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.action.ActionServlet.proces
s(ActionServlet.java:1187)
19:58:59,637 ERROR [STDERR] at
org.apache.struts.action.ActionServlet.doPost
(ActionServlet.java:451)
19:58:59,637 ERROR [STDERR] at
javax.servlet.http.HttpServlet.service(HttpSe
rvlet.java:760)
19:58:59,637 ERROR [STDERR] at
javax.servlet.http.HttpServlet.service(HttpSe
rvlet.java:853)
19:58:59,637 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterCha
in.internalDoFilter(ApplicationFilterChain.java:247)
19:58:59,637 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterCha
in.doFilter(ApplicationFilterChain.java:193)
19:58:59,637 ERROR [STDERR] at
com.adobe.edc.server.presentation.auth.Authen
ticationFilter.doFilter

Validator doubt

2004-03-05 Thread MOHAN RADHAKRISHNAN
Hi

My validator only works for 'required' fields. Eventhough I have the
following in the same XML it is not working. Is this right ? My
configuration is right because the same validator works for 'required'
fields.


 field
 property=cocNumber
 depends=integer
 msg name=integer key=error.coc.check/
 arg0 key=label.coc.incident/
  /field

So if I input a value that is not a integer in this particular field I
should see a message specified by msg name=integer
key=error.coc.check/

Thanks
Mohan


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



Re: Validator doubt

2004-03-05 Thread Adam Hardy
On 03/05/2004 12:33 PM MOHAN RADHAKRISHNAN wrote:
 field
 property=cocNumber
 depends=integer
 msg name=integer key=error.coc.check/
 arg0 key=label.coc.incident/
  /field
So if I input a value that is not a integer in this particular field I
should see a message specified by msg name=integer
key=error.coc.check/
Why are specifying a different msg key? There is a default one already 
'errors.integer', if you have put it in your ApplicationResources.

Adam
--
struts 1.1 + tomcat 5.0.16 + java 1.4.2
Linux 2.4.20 Debian
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Numeric validator

2004-03-04 Thread MOHAN RADHAKRISHNAN
Hi

There are the steps I am following for a numeric check with struts
validator. I don't see the proper message and the check is passing. What
could be the problem ?

 validation.xml

 field
 property=windSpeed
 depends=integer
 msg name=integer key=error.wind.check/
 arg0 key=label.wind.incident/
  /field

in the properties file.

error.wind.check=Wind speed is a number



  in my JSP

  html:errors/
  html:errors property=errors.required/

   Do I have to use html:errors property=errors.integer/

Help is appreciated.

Mohan


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



Re: Numeric validator

2004-03-04 Thread Niall Pemberton
Your can either display all errors:

   html:errors/

or errors for a specific property.
   
   html:errors property=windSpeed/

http://jakarta.apache.org/struts/userGuide/struts-html.html#errors


- Original Message - 
From: MOHAN RADHAKRISHNAN [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Thursday, March 04, 2004 9:08 AM
Subject: Numeric validator


 Hi
 
 There are the steps I am following for a numeric check with struts
 validator. I don't see the proper message and the check is passing. What
 could be the problem ?
 
  validation.xml
 
  field
  property=windSpeed
  depends=integer
 msg name=integer key=error.wind.check/
  arg0 key=label.wind.incident/
   /field
 
 in the properties file.
 
 error.wind.check=Wind speed is a number
 
 
 
   in my JSP
 
   html:errors/
   html:errors property=errors.required/
 
Do I have to use html:errors property=errors.integer/
 
 Help is appreciated.
 
 Mohan
 
 
 -
 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: Numeric validator

2004-03-04 Thread MOHAN RADHAKRISHNAN
Thanks.
 I was trying to find out why this particular check is not run while
the depends=required check in the same validation.xml is run.
 I can see that this check is not run because it passes control to
the action. My field type in the form that this check applies to is
'String'. Is that a problem ?

Mohan

-Original Message-
From: Niall Pemberton [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 04, 2004 3:20 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: Re: Numeric validator


Your can either display all errors:

   html:errors/

or errors for a specific property.

   html:errors property=windSpeed/

http://jakarta.apache.org/struts/userGuide/struts-html.html#errors


- Original Message -
From: MOHAN RADHAKRISHNAN [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Thursday, March 04, 2004 9:08 AM
Subject: Numeric validator


 Hi

 There are the steps I am following for a numeric check with struts
 validator. I don't see the proper message and the check is passing. What
 could be the problem ?

  validation.xml

  field
  property=windSpeed
  depends=integer
 msg name=integer key=error.wind.check/
  arg0 key=label.wind.incident/
   /field

 in the properties file.

 error.wind.check=Wind speed is a number



   in my JSP

   html:errors/
   html:errors property=errors.required/

Do I have to use html:errors property=errors.integer/

 Help is appreciated.

 Mohan


 -
 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: Numeric validator

2004-03-04 Thread Mark Lowe
No the field type should be string like all form properties.

On 4 Mar 2004, at 12:39, MOHAN RADHAKRISHNAN wrote:

Thanks.
 I was trying to find out why this particular check is not run 
while
the depends=required check in the same validation.xml is run.
 I can see that this check is not run because it passes 
control to
the action. My field type in the form that this check applies to is
'String'. Is that a problem ?

Mohan

-Original Message-
From: Niall Pemberton [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 04, 2004 3:20 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: Re: Numeric validator
Your can either display all errors:

   html:errors/

or errors for a specific property.

   html:errors property=windSpeed/

http://jakarta.apache.org/struts/userGuide/struts-html.html#errors

- Original Message -
From: MOHAN RADHAKRISHNAN [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Thursday, March 04, 2004 9:08 AM
Subject: Numeric validator

Hi

There are the steps I am following for a numeric check with struts
validator. I don't see the proper message and the check is passing. 
What
could be the problem ?

 validation.xml

 field
 property=windSpeed
 depends=integer
msg name=integer key=error.wind.check/
 arg0 key=label.wind.incident/
  /field
in the properties file.

error.wind.check=Wind speed is a number



  in my JSP

  html:errors/
  html:errors property=errors.required/
   Do I have to use html:errors property=errors.integer/

Help is appreciated.

Mohan

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


validator-rules.xml

2004-03-04 Thread Adam Hardy
Where can I get the latest validator-rules.xml from?

I looked for it on jakarta-struts website and jakarta-commons, but can't 
find it. Even checked the archives before coming here to make myself 
look foolish.

Obviously I am assuming that this is a standard part of the code base - 
or is it? I need the latest javascript for the validate-url rule, that's 
why. But then it occurred to me that it might be the same as 
struts-config.xml, i.e. roll-your-own.

Thanks
Adam
--
struts 1.1 + tomcat 5.0.16 + java 1.4.2
Linux 2.4.20 Debian
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: validator-rules.xml

2004-03-04 Thread Wendy Smoak
 From: Adam Hardy [mailto:[EMAIL PROTECTED] 
 Where can I get the latest validator-rules.xml from?

In the 1.2.0 distribution, it's in the 'lib' subdirectory along with the
.jar files.

 Obviously I am assuming that this is a standard part of the 
 code base - or is it? I need the latest javascript for the
validate-url 
 rule, that's why. But then it occurred to me that it might be the same
as 
 struts-config.xml, i.e. roll-your-own.

The part you write generally goes in validation.xml.  For instance, I
have some custom validators, and I added a global section to the top
of validation.xml to define them.  That is also where I have the form
and field tags.  

The file names are arbitrary, you can change them as long as the
Validator plugin tag in struts-config.xml matches.  But, as delivered,
the provided rules are in validator-rules.xml, and the convention is to
do your custom setup in validation.xml.

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 

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



Re: validator-rules.xml

2004-03-04 Thread Niall Pemberton
validation-rules.xml is here
  http://cvs.apache.org/viewcvs.cgi/jakarta-struts/conf/share/

but, with struts 1.2 the javascript moved out of the XML into .js files
in commons here:

http://cvs.apache.org/viewcvs.cgi/jakarta-commons/validator/src/javascript/org/apache/commons/validator/javascript/

However, although there is a validateUrl method in the struts FieldChecks
class, I don't think the validation-rules.xml shipped with struts has ever
had a validator defined which uses it and therefore there is no javascript
in 1.1 and there doesn't appear to be a valudateUrl.js file in struts 1.2.

Doesn't make alot of sense to me, to go to the trouble of writing a
validateUrl method in FieldChecks and not ship the config - maybe somone
else will know more


Niall

- Original Message - 
From: Adam Hardy [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, March 04, 2004 4:44 PM
Subject: validator-rules.xml


 Where can I get the latest validator-rules.xml from?

 I looked for it on jakarta-struts website and jakarta-commons, but can't
 find it. Even checked the archives before coming here to make myself
 look foolish.

 Obviously I am assuming that this is a standard part of the code base -
 or is it? I need the latest javascript for the validate-url rule, that's
 why. But then it occurred to me that it might be the same as
 struts-config.xml, i.e. roll-your-own.

 Thanks
 Adam
 -- 
 struts 1.1 + tomcat 5.0.16 + java 1.4.2
 Linux 2.4.20 Debian


 -
 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: validator-rules.xml

2004-03-04 Thread Adam Hardy
OK, well I can't find the validator-rules.xml anywhere else, so I guess 
I'll have to download the struts 1.2 binary!

I was looking through the validator's urlValidator class and it's pretty 
complicated with lots of perl-based pattern matching, so I'm not 
surprised there's no javascript equivalent (yet... hopefully)

Thanks for the pointers.

Adam

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


JXPath Validator

2004-03-03 Thread Michael Nascimento Santos
Hi guys,

I am just wondering: you guys have developed validwhen so we could have a
more powerful validator, right? But, while using just commons-validator in a
GUI (non-web) project, I noticed I could implement a very powerful validator
using
JXPath.

Here is the code for the static method:

   public static boolean validateJXPath(Object bean, Field field) {
  final JXPathContext ctx = JXPathContext.newContext(bean);

  return
!Boolean.FALSE.equals(ctx.getValue(field.getVarValue(jxpath)));
   }

Notice it's just a simple validator with no dependencies on
HttpServletRequest or ActionErrors. I don't know that much about validwhen,
but from what I've seen, XPath expressions can do everything validwhen
expressions can and even more.

Am I missing something? Is there any reason why a JXPath-based validator as
the above wouldn't be suitable for Struts?

Regards,
Michael Nascimento Santos
JSR 207 Expert Group Member
http://today.java.net/pub/au/80
Sun Certified Programmer for the Java 2 Platform 1.4
Sun Certified Web Component Developer for J2EE
Moderador SouJava - http://www.soujava.org.br

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



Re: Struts logic combined with the struts validator

2004-03-03 Thread Alexander Craen
is there anyone on this list who writes his own validators ?
- Original Message - 
From: Alexander Craen [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Tuesday, March 02, 2004 11:41 PM
Subject: Re: Struts logic combined with the struts validator


 I`ve been looking some more into the case and I think its becoming more of
a
 design matter...

 I dont know if I am using struts the right way or not.
 Problem is that I am building business logic into my forms.. Is this good
or
 not?
 logic :if you are a business customer (based on a session bean)...  
 html:text ask for his VAT number
 /logic

 Should I make 2 different pages or use tiles or something completely else?
 problem is that on the first page I ask 5 questions to the customer. Based
 on their choices the second form is built up. all business related
stuff...

 I  tried to write a validator like requiredif but based on beans from
 somewhere in your scope
 struts logic can work on beans from your session or request scope because
it
 has streight access to the pagecontext
 I dont find a way to really access my pageContext in the validator.
 but do you want your validator actually reading from your request scope or
 session scope?

 tnx for your time :)

 Alexander Craen



 - Original Message - 
 From: Alexander Craen [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Tuesday, March 02, 2004 3:38 PM
 Subject: Re: Struts logic combined with the struts validator


  Well ,
 
  I thought about this as well.. however I cannot put bogus information in
 the
  fields because their 'NULL' value matters to the registration process
 
  I would have to filter on the bogus information... which I would not
like
 to
  do
 
  tnx
 
  Alexander Craen
 
  - Original Message - 
  From: Matt Bathje [EMAIL PROTECTED]
  To: Struts Users Mailing List [EMAIL PROTECTED]
  Sent: Tuesday, March 02, 2004 3:24 PM
  Subject: Re: Struts logic combined with the struts validator
 
 
   Alexander -
  
   Usually when I have this situation I just put in an else (or a
   logic:notEqual in your case) which prints out the form field as hidden
  with
   some bogus data in it. That bogus data will be enough to make the
   validation pass of course.
  
   I had thought about doing the requiredifpresent or something like
that,
  but
   this always seemed much simpler.
  
   Matt Bathje
  
   - Original Message - 
   From: Alexander Craen [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Tuesday, March 02, 2004 8:14 AM
   Subject: Re: Struts logic combined with the struts validator
  
  
Maybe i`ll better rephrase my question to make it more easy for the
  reader
:)
   
I want to make a field in a form required when it exists on the form
   
if it is not on the form (due to some logic tags that make it
  disappear),
   I
dont want to generate an error.
   
How would I best solve this?
   
make a new validator requiredifpresent ?
or could I use the requiredif together with some logic based on
values
  in
other beans ?
   
   
- Original Message - 
From: Alexander Craen [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, March 02, 2004 11:25 AM
Subject: Struts logic combined with the struts validato
   
   
 Hello,
 I am making a registration procedure that works with some logic
 based
  on
the
 choices the customer makes on a previous page

 logic:equal name=LogonForm property=customertype
 scope=session
 value=business
 span class=labellabelbean:message
 key=text.data.label.bill_vat_number//label/span
 html:text property=bill_vat_nr styleId=bill_vat_nr /
 /logic:equal

 Problem description :
 When a customer is of customertype 'business' the field
bill_vat_nr
 is
 showed on the page and is required when a customer is not of
   customertype
 'business' the field bill_vat_nr is not showed on the page and
  theirfor
   is
 not required

 I tried to use a standard struts validator implementation
 field property=bill_vat_nr depends=required
 arg0 key=text.data.label.bill_vat_number/
 arg1 key=${dummy}/
 /field

 I first thought about using the requiredif implementation. Problem
 is
   that
I
 only get it to work with elements from the same form.

 The result :
 The bill_vat_nr is required even if it has been left out of the
form
  by
 struts logic

 My question :
 Is their a way to combine struts logic and the validator
framework?
 Do
  I
 have to write a custom validator that does some kind of
 introspection
  on
the
 jsp? Or are their validators that are used for that purpose? What
  would
   be
 the best solution to tackle this problem?

 Tnx in advance
 Alexander Craen

Re: JXPath Validator

2004-03-03 Thread Niall Pemberton
Sounds good to me.

I don't know if the validator guys considered JXPath, but why don't you
submit an enhacement request using bugzilla to commons with your JXPath
validator attached (if you include JUnit tests you'll impress them even
more).

For some reason the 'validwhen' validator is part of struts (rather than
commons validator) - I don't know why this is. From the look of it, it could
have been implemented in commons with a method in struts to call it. From
what I can see the only reason validwhen needs the HttpServletRequest is so
that it can get error messages. Presumably to process error messages in the
same way in a struts environment, yours would need to do a similar thing -
but that could be handled with a validate method in struts which calls your
commons JXPath validator.

Niall

- Original Message - 
From: Michael Nascimento Santos [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Wednesday, March 03, 2004 3:42 PM
Subject: JXPath Validator


 Hi guys,

 I am just wondering: you guys have developed validwhen so we could have a
 more powerful validator, right? But, while using just commons-validator in
a
 GUI (non-web) project, I noticed I could implement a very powerful
validator
 using
 JXPath.

 Here is the code for the static method:

public static boolean validateJXPath(Object bean, Field field) {
   final JXPathContext ctx = JXPathContext.newContext(bean);

   return
 !Boolean.FALSE.equals(ctx.getValue(field.getVarValue(jxpath)));
}

 Notice it's just a simple validator with no dependencies on
 HttpServletRequest or ActionErrors. I don't know that much about
validwhen,
 but from what I've seen, XPath expressions can do everything validwhen
 expressions can and even more.

 Am I missing something? Is there any reason why a JXPath-based validator
as
 the above wouldn't be suitable for Struts?

 Regards,
 Michael Nascimento Santos
 JSR 207 Expert Group Member
 http://today.java.net/pub/au/80
 Sun Certified Programmer for the Java 2 Platform 1.4
 Sun Certified Web Component Developer for J2EE
 Moderador SouJava - http://www.soujava.org.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: Validator multiple message-resources

2004-03-02 Thread Mainguy, Mike
I'm not 100% sure but I believe this came up before.  I that, while you can
define multiple message.resources, you really can only actually USE one of
them in sruts 1.1.  I'd do a search of the archive because I think this has
come up before.

An Obstacle is something you see when you take your eyes off the goal

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 01, 2004 7:42 PM
To: [EMAIL PROTECTED]
Subject: Validator  multiple message-resources


Hi,

I have successfully used validator with a single message resources file
specified in the config file, everything works out fine. Since the project
has gotten bigger, i created another message-resource file but when
'required' error happens, the message specifying the field name which is in
the 2nd file doesn't come out. Only the validator part which is specified in
the 1st file comes out.

Amin

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

-
This message and its contents (to include attachments) are the property of Kmart 
Corporation (Kmart) and may contain confidential and proprietary information. You are 
hereby notified that any disclosure, copying, or distribution of this message, or the 
taking of any action based on information contained herein is strictly prohibited. 
Unauthorized use of information contained herein may subject you to civil and criminal 
prosecution and penalties. If you are not the intended recipient, you should delete 
this message immediately.


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



Re: Struts logic combined with the struts validator

2004-03-02 Thread Alexander Craen
Maybe i`ll better rephrase my question to make it more easy for the reader
:)

I want to make a field in a form required when it exists on the form

if it is not on the form (due to some logic tags that make it disappear), I
dont want to generate an error.

How would I best solve this?

make a new validator requiredifpresent ?
or could I use the requiredif together with some logic based on values in
other beans ?


- Original Message - 
From: Alexander Craen [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, March 02, 2004 11:25 AM
Subject: Struts logic combined with the struts validato


 Hello,
 I am making a registration procedure that works with some logic based on
the
 choices the customer makes on a previous page

 logic:equal name=LogonForm property=customertype scope=session
 value=business
 span class=labellabelbean:message
 key=text.data.label.bill_vat_number//label/span
 html:text property=bill_vat_nr styleId=bill_vat_nr /
 /logic:equal

 Problem description :
 When a customer is of customertype 'business' the field bill_vat_nr is
 showed on the page and is required when a customer is not of customertype
 'business' the field bill_vat_nr is not showed on the page and theirfor is
 not required

 I tried to use a standard struts validator implementation
 field property=bill_vat_nr depends=required
 arg0 key=text.data.label.bill_vat_number/
 arg1 key=${dummy}/
 /field

 I first thought about using the requiredif implementation. Problem is that
I
 only get it to work with elements from the same form.

 The result :
 The bill_vat_nr is required even if it has been left out of the form by
 struts logic

 My question :
 Is their a way to combine struts logic and the validator framework? Do I
 have to write a custom validator that does some kind of introspection on
the
 jsp? Or are their validators that are used for that purpose? What would be
 the best solution to tackle this problem?

 Tnx in advance
 Alexander Craen


 -
 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 logic combined with the struts validator

2004-03-02 Thread Matt Bathje
Alexander -

Usually when I have this situation I just put in an else (or a
logic:notEqual in your case) which prints out the form field as hidden with
some bogus data in it. That bogus data will be enough to make the
validation pass of course.

I had thought about doing the requiredifpresent or something like that, but
this always seemed much simpler.

Matt Bathje

- Original Message - 
From: Alexander Craen [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, March 02, 2004 8:14 AM
Subject: Re: Struts logic combined with the struts validator


 Maybe i`ll better rephrase my question to make it more easy for the reader
 :)

 I want to make a field in a form required when it exists on the form

 if it is not on the form (due to some logic tags that make it disappear),
I
 dont want to generate an error.

 How would I best solve this?

 make a new validator requiredifpresent ?
 or could I use the requiredif together with some logic based on values in
 other beans ?


 - Original Message - 
 From: Alexander Craen [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, March 02, 2004 11:25 AM
 Subject: Struts logic combined with the struts validato


  Hello,
  I am making a registration procedure that works with some logic based on
 the
  choices the customer makes on a previous page
 
  logic:equal name=LogonForm property=customertype scope=session
  value=business
  span class=labellabelbean:message
  key=text.data.label.bill_vat_number//label/span
  html:text property=bill_vat_nr styleId=bill_vat_nr /
  /logic:equal
 
  Problem description :
  When a customer is of customertype 'business' the field bill_vat_nr is
  showed on the page and is required when a customer is not of
customertype
  'business' the field bill_vat_nr is not showed on the page and theirfor
is
  not required
 
  I tried to use a standard struts validator implementation
  field property=bill_vat_nr depends=required
  arg0 key=text.data.label.bill_vat_number/
  arg1 key=${dummy}/
  /field
 
  I first thought about using the requiredif implementation. Problem is
that
 I
  only get it to work with elements from the same form.
 
  The result :
  The bill_vat_nr is required even if it has been left out of the form by
  struts logic
 
  My question :
  Is their a way to combine struts logic and the validator framework? Do I
  have to write a custom validator that does some kind of introspection on
 the
  jsp? Or are their validators that are used for that purpose? What would
be
  the best solution to tackle this problem?
 
  Tnx in advance
  Alexander Craen
 
 
  -
  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: Struts logic combined with the struts validator

2004-03-02 Thread Alexander Craen
Well ,

I thought about this as well.. however I cannot put bogus information in the
fields because their 'NULL' value matters to the registration process

I would have to filter on the bogus information... which I would not like to
do

tnx

Alexander Craen

- Original Message - 
From: Matt Bathje [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Tuesday, March 02, 2004 3:24 PM
Subject: Re: Struts logic combined with the struts validator


 Alexander -

 Usually when I have this situation I just put in an else (or a
 logic:notEqual in your case) which prints out the form field as hidden
with
 some bogus data in it. That bogus data will be enough to make the
 validation pass of course.

 I had thought about doing the requiredifpresent or something like that,
but
 this always seemed much simpler.

 Matt Bathje

 - Original Message - 
 From: Alexander Craen [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, March 02, 2004 8:14 AM
 Subject: Re: Struts logic combined with the struts validator


  Maybe i`ll better rephrase my question to make it more easy for the
reader
  :)
 
  I want to make a field in a form required when it exists on the form
 
  if it is not on the form (due to some logic tags that make it
disappear),
 I
  dont want to generate an error.
 
  How would I best solve this?
 
  make a new validator requiredifpresent ?
  or could I use the requiredif together with some logic based on values
in
  other beans ?
 
 
  - Original Message - 
  From: Alexander Craen [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Tuesday, March 02, 2004 11:25 AM
  Subject: Struts logic combined with the struts validato
 
 
   Hello,
   I am making a registration procedure that works with some logic based
on
  the
   choices the customer makes on a previous page
  
   logic:equal name=LogonForm property=customertype scope=session
   value=business
   span class=labellabelbean:message
   key=text.data.label.bill_vat_number//label/span
   html:text property=bill_vat_nr styleId=bill_vat_nr /
   /logic:equal
  
   Problem description :
   When a customer is of customertype 'business' the field bill_vat_nr is
   showed on the page and is required when a customer is not of
 customertype
   'business' the field bill_vat_nr is not showed on the page and
theirfor
 is
   not required
  
   I tried to use a standard struts validator implementation
   field property=bill_vat_nr depends=required
   arg0 key=text.data.label.bill_vat_number/
   arg1 key=${dummy}/
   /field
  
   I first thought about using the requiredif implementation. Problem is
 that
  I
   only get it to work with elements from the same form.
  
   The result :
   The bill_vat_nr is required even if it has been left out of the form
by
   struts logic
  
   My question :
   Is their a way to combine struts logic and the validator framework? Do
I
   have to write a custom validator that does some kind of introspection
on
  the
   jsp? Or are their validators that are used for that purpose? What
would
 be
   the best solution to tackle this problem?
  
   Tnx in advance
   Alexander Craen
  
  
   -
   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: Struts logic combined with the struts validator

2004-03-02 Thread Alexander Craen
I`ve been looking some more into the case and I think its becoming more of a
design matter...

I dont know if I am using struts the right way or not.
Problem is that I am building business logic into my forms.. Is this good or
not?
logic :if you are a business customer (based on a session bean)...  
html:text ask for his VAT number
/logic

Should I make 2 different pages or use tiles or something completely else?
problem is that on the first page I ask 5 questions to the customer. Based
on their choices the second form is built up. all business related stuff...

I  tried to write a validator like requiredif but based on beans from
somewhere in your scope
struts logic can work on beans from your session or request scope because it
has streight access to the pagecontext
I dont find a way to really access my pageContext in the validator.
but do you want your validator actually reading from your request scope or
session scope?

tnx for your time :)

Alexander Craen



- Original Message - 
From: Alexander Craen [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Tuesday, March 02, 2004 3:38 PM
Subject: Re: Struts logic combined with the struts validator


 Well ,

 I thought about this as well.. however I cannot put bogus information in
the
 fields because their 'NULL' value matters to the registration process

 I would have to filter on the bogus information... which I would not like
to
 do

 tnx

 Alexander Craen

 - Original Message - 
 From: Matt Bathje [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Tuesday, March 02, 2004 3:24 PM
 Subject: Re: Struts logic combined with the struts validator


  Alexander -
 
  Usually when I have this situation I just put in an else (or a
  logic:notEqual in your case) which prints out the form field as hidden
 with
  some bogus data in it. That bogus data will be enough to make the
  validation pass of course.
 
  I had thought about doing the requiredifpresent or something like that,
 but
  this always seemed much simpler.
 
  Matt Bathje
 
  - Original Message - 
  From: Alexander Craen [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Tuesday, March 02, 2004 8:14 AM
  Subject: Re: Struts logic combined with the struts validator
 
 
   Maybe i`ll better rephrase my question to make it more easy for the
 reader
   :)
  
   I want to make a field in a form required when it exists on the form
  
   if it is not on the form (due to some logic tags that make it
 disappear),
  I
   dont want to generate an error.
  
   How would I best solve this?
  
   make a new validator requiredifpresent ?
   or could I use the requiredif together with some logic based on values
 in
   other beans ?
  
  
   - Original Message - 
   From: Alexander Craen [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Tuesday, March 02, 2004 11:25 AM
   Subject: Struts logic combined with the struts validato
  
  
Hello,
I am making a registration procedure that works with some logic
based
 on
   the
choices the customer makes on a previous page
   
logic:equal name=LogonForm property=customertype
scope=session
value=business
span class=labellabelbean:message
key=text.data.label.bill_vat_number//label/span
html:text property=bill_vat_nr styleId=bill_vat_nr /
/logic:equal
   
Problem description :
When a customer is of customertype 'business' the field bill_vat_nr
is
showed on the page and is required when a customer is not of
  customertype
'business' the field bill_vat_nr is not showed on the page and
 theirfor
  is
not required
   
I tried to use a standard struts validator implementation
field property=bill_vat_nr depends=required
arg0 key=text.data.label.bill_vat_number/
arg1 key=${dummy}/
/field
   
I first thought about using the requiredif implementation. Problem
is
  that
   I
only get it to work with elements from the same form.
   
The result :
The bill_vat_nr is required even if it has been left out of the form
 by
struts logic
   
My question :
Is their a way to combine struts logic and the validator framework?
Do
 I
have to write a custom validator that does some kind of
introspection
 on
   the
jsp? Or are their validators that are used for that purpose? What
 would
  be
the best solution to tackle this problem?
   
Tnx in advance
Alexander Craen
   
   
  
 -
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

Validator multiple message-resources

2004-03-01 Thread amind
Hi,

I have successfully used validator with a single message resources file
specified in the config file, everything works out fine. Since the project
has gotten bigger, i created another message-resource file but when
'required' error happens, the message specifying the field name which is
in the 2nd file doesn't come out. Only the validator part which is
specified in the 1st file comes out.

Amin

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



custom validator question

2004-02-26 Thread Anderson, James H [IT]
I'm creating a custom validator to enforce a = relationship between 2 date fields and 
am having a problem.

A validator method gets a Field arg for the field with which it's associated in 
validation.xml, but I need to also get the Field object for the other date field. I 
need this so that I can get its property name for display in an error message. (I'd 
also like to be able to get the field's datePattern.) I can't figure out how to do 
this.

Any help would be much appreciated!

jim

Here's the relevant part of my validation.xml file:

  form name=ActivityViewForm
field
   property=starting
   depends=date
  arg0 key=ActivityViewForm.starting.displayname/
  var
var-namedatePatternStrict/var-name
var-valueMM/dd//var-value
  /var
/field
field
   property=ending
   depends=date,date1LEdate2
  arg0 key=ActivityViewForm.ending.displayname/
  var
var-namedatePatternStrict/var-name
var-valueMM/dd//var-value
  /var
  var
var-namedate1/var-name
var-valuestarting/var-value
  /var
/field
  /form

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



RE: custom validator question

2004-02-26 Thread Anderson, James H [IT]
I guess I wasn't clear (also, I was a bit confused :)

My validator is already working, and what you suggest below will get me the
property name I need for display in an error msg. But how can I get the
datePattern from mySecondDate? At the moment I'm assuming it'll be the same
as for myFirstDate, but that's just an assumption...

-Original Message-
From: Niall Pemberton [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 26, 2004 10:18 AM
To: Struts Users Mailing List
Subject: Re: custom validator question


Specify the second field as var

field property=myFirstDate depends=date,dateCompare
 var
 var-namedatePattern/var-name
 var-valuedd/MM//var-value
 /var
 var
 var-namecompareDate/var-name
 var-valuemySecondDate/var-value
 /var
/field

Then in your custom validation method:

String datePattern = field.getVarValue(datePattern);
String compareDateProperty = field.getVarValue(compareDate);

String compareDate = ValidatorUtils.getValueAsString(bean,
compareDateProperty);


Niall

- Original Message - 
From: Anderson, James H [IT] [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, February 26, 2004 2:54 PM
Subject: custom validator question


I'm creating a custom validator to enforce a = relationship between 2 date
fields and am having a problem.

A validator method gets a Field arg for the field with which it's associated
in validation.xml, but I need to also get the Field object for the other
date field. I need this so that I can get its property name for display in
an error message. (I'd also like to be able to get the field's datePattern.)
I can't figure out how to do this.

Any help would be much appreciated!

jim

Here's the relevant part of my validation.xml file:

  form name=ActivityViewForm
field
   property=starting
   depends=date
  arg0 key=ActivityViewForm.starting.displayname/
  var
var-namedatePatternStrict/var-name
var-valueMM/dd//var-value
  /var
/field
field
   property=ending
   depends=date,date1LEdate2
  arg0 key=ActivityViewForm.ending.displayname/
  var
var-namedatePatternStrict/var-name
var-valueMM/dd//var-value
  /var
  var
var-namedate1/var-name
var-valuestarting/var-value
  /var
/field
  /form

-
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: custom validator question

2004-02-26 Thread Anderson, James H [IT]
I wasn't aware of it--I'm using Struts 1.1. I'll check it out.

Thanks.

-Original Message-
From: Niall Pemberton [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 26, 2004 10:20 AM
To: Struts User Jakarta
Subject: Re: custom validator question


Also, what about using the existing ValidWhen validation

   http://jakarta.apache.org/struts/userGuide/dev_validator.html

Niall
- Original Message - 
From: Niall Pemberton [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, February 26, 2004 3:17 PM
Subject: Re: custom validator question


 Specify the second field as var

 field property=myFirstDate depends=date,dateCompare
  var
  var-namedatePattern/var-name
  var-valuedd/MM//var-value
  /var
  var
  var-namecompareDate/var-name
  var-valuemySecondDate/var-value
  /var
 /field

 Then in your custom validation method:

 String datePattern = field.getVarValue(datePattern);
 String compareDateProperty = field.getVarValue(compareDate);

 String compareDate = ValidatorUtils.getValueAsString(bean,
 compareDateProperty);


 Niall

 - Original Message - 
 From: Anderson, James H [IT] [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, February 26, 2004 2:54 PM
 Subject: custom validator question


 I'm creating a custom validator to enforce a = relationship between 2
date
 fields and am having a problem.

 A validator method gets a Field arg for the field with which it's
associated
 in validation.xml, but I need to also get the Field object for the other
 date field. I need this so that I can get its property name for display in
 an error message. (I'd also like to be able to get the field's
datePattern.)
 I can't figure out how to do this.

 Any help would be much appreciated!

 jim

 Here's the relevant part of my validation.xml file:

   form name=ActivityViewForm
 field
property=starting
depends=date
   arg0 key=ActivityViewForm.starting.displayname/
   var
 var-namedatePatternStrict/var-name
 var-valueMM/dd//var-value
   /var
 /field
 field
property=ending
depends=date,date1LEdate2
   arg0 key=ActivityViewForm.ending.displayname/
   var
 var-namedatePatternStrict/var-name
 var-valueMM/dd//var-value
   /var
   var
 var-namedate1/var-name
 var-valuestarting/var-value
   /var
 /field
   /form

 -
 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: custom validator question

2004-02-26 Thread claire knowles
I had a custom validator 'futureDate' for which I needed to pass in a
date and time which were 2 different form fields, to check that the date
was in the future.

I passed 2 different values into a custom parameter using two args and
vars:

form name=form
field property=emailDate depends=required, mask, futureDate
msg name=mask key=errors.invalid/
  arg0 key=form.emailDate/
  arg1 key=form.emailTime/
  var
var-namemask/var-name
var-value${dateMask}/var-value
  /var
  var
var-nametime/var-name
var-valueemailTime/var-value
  /var
/field
/form

In the custom validator I retrieved the two values using:

public static boolean validateDate(Object bean, ValidatorAction va,
Field field, ActionErrors errors, HttpServletRequest request)
{
String value;

if (isString(bean))
{
value = (String) bean;
}
else
{
value = ValidatorUtil.getValueAsString(bean,
field.getProperty());
}

String propertyTime = field.getVarValue(time);
String valueTime = ValidatorUtil.getValueAsString(bean,
propertyTime);

. . . . .

Hope this helps

Claire

-Original Message-
From: Anderson, James H [IT] [mailto:[EMAIL PROTECTED] 
Sent: 26 February 2004 14:54
To: [EMAIL PROTECTED]
Subject: custom validator question


I'm creating a custom validator to enforce a = relationship between 2
date fields and am having a problem.

A validator method gets a Field arg for the field with which it's
associated in validation.xml, but I need to also get the Field object
for the other date field. I need this so that I can get its property
name for display in an error message. (I'd also like to be able to get
the field's datePattern.) I can't figure out how to do this.

Any help would be much appreciated!

jim

Here's the relevant part of my validation.xml file:

  form name=ActivityViewForm
field
   property=starting
   depends=date
  arg0 key=ActivityViewForm.starting.displayname/
  var
var-namedatePatternStrict/var-name
var-valueMM/dd//var-value
  /var
/field
field
   property=ending
   depends=date,date1LEdate2
  arg0 key=ActivityViewForm.ending.displayname/
  var
var-namedatePatternStrict/var-name
var-valueMM/dd//var-value
  /var
  var
var-namedate1/var-name
var-valuestarting/var-value
  /var
/field
  /form




E-mail is an informal method of communication and may be subject to data corruption, 
interception and unauthorised amendment for which Digital Bridges Ltd will accept no 
liability. Therefore, it will normally be inappropriate to rely on information 
contained on e-mail without obtaining written confirmation.

This e-mail may contain confidential and/or privileged information. If you are not the 
intended recipient (or have received this e-mail in error) please notify the sender 
immediately and destroy this e-mail. Any unauthorized copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden.




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



Re: custom validator question

2004-02-26 Thread Niall Pemberton
Also, what about using the existing ValidWhen validation

   http://jakarta.apache.org/struts/userGuide/dev_validator.html

Niall
- Original Message - 
From: Niall Pemberton [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, February 26, 2004 3:17 PM
Subject: Re: custom validator question


 Specify the second field as var

 field property=myFirstDate depends=date,dateCompare
  var
  var-namedatePattern/var-name
  var-valuedd/MM//var-value
  /var
  var
  var-namecompareDate/var-name
  var-valuemySecondDate/var-value
  /var
 /field

 Then in your custom validation method:

 String datePattern = field.getVarValue(datePattern);
 String compareDateProperty = field.getVarValue(compareDate);

 String compareDate = ValidatorUtils.getValueAsString(bean,
 compareDateProperty);


 Niall

 - Original Message - 
 From: Anderson, James H [IT] [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, February 26, 2004 2:54 PM
 Subject: custom validator question


 I'm creating a custom validator to enforce a = relationship between 2
date
 fields and am having a problem.

 A validator method gets a Field arg for the field with which it's
associated
 in validation.xml, but I need to also get the Field object for the other
 date field. I need this so that I can get its property name for display in
 an error message. (I'd also like to be able to get the field's
datePattern.)
 I can't figure out how to do this.

 Any help would be much appreciated!

 jim

 Here's the relevant part of my validation.xml file:

   form name=ActivityViewForm
 field
property=starting
depends=date
   arg0 key=ActivityViewForm.starting.displayname/
   var
 var-namedatePatternStrict/var-name
 var-valueMM/dd//var-value
   /var
 /field
 field
property=ending
depends=date,date1LEdate2
   arg0 key=ActivityViewForm.ending.displayname/
   var
 var-namedatePatternStrict/var-name
 var-valueMM/dd//var-value
   /var
   var
 var-namedate1/var-name
 var-valuestarting/var-value
   /var
 /field
   /form

 -
 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: custom validator question

2004-02-26 Thread Niall Pemberton
Specify the second field as var

field property=myFirstDate depends=date,dateCompare
 var
 var-namedatePattern/var-name
 var-valuedd/MM//var-value
 /var
 var
 var-namecompareDate/var-name
 var-valuemySecondDate/var-value
 /var
/field

Then in your custom validation method:

String datePattern = field.getVarValue(datePattern);
String compareDateProperty = field.getVarValue(compareDate);

String compareDate = ValidatorUtils.getValueAsString(bean,
compareDateProperty);


Niall

- Original Message - 
From: Anderson, James H [IT] [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, February 26, 2004 2:54 PM
Subject: custom validator question


I'm creating a custom validator to enforce a = relationship between 2 date
fields and am having a problem.

A validator method gets a Field arg for the field with which it's associated
in validation.xml, but I need to also get the Field object for the other
date field. I need this so that I can get its property name for display in
an error message. (I'd also like to be able to get the field's datePattern.)
I can't figure out how to do this.

Any help would be much appreciated!

jim

Here's the relevant part of my validation.xml file:

  form name=ActivityViewForm
field
   property=starting
   depends=date
  arg0 key=ActivityViewForm.starting.displayname/
  var
var-namedatePatternStrict/var-name
var-valueMM/dd//var-value
  /var
/field
field
   property=ending
   depends=date,date1LEdate2
  arg0 key=ActivityViewForm.ending.displayname/
  var
var-namedatePatternStrict/var-name
var-valueMM/dd//var-value
  /var
  var
var-namedate1/var-name
var-valuestarting/var-value
  /var
/field
  /form

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



Bug in Validator javascript, not showing all errors?

2004-02-25 Thread Mike Millson
I have a form with 1 text field and 1 password field:
username: required and maxlength 10
password: required

The return statement for the validateLoginForm function generated in the
dynamic javascript:

return validateMaxLength(form)  validateRequired(form); 

If I enter a username that is too long, validateMaxLength returns false, so 
validateRequired is never evaluated. The result is that only the error about username 
being too long is displayed, even if password is empty.

This is not how it works on the server side. If I disable javascript and submit, the 
server side displays both errors: username too long and password required.

Is this a bug? Why aren't the client side and server side validation
results equal?

Thank you,
Mike


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



RE: Bug in Validator javascript, not showing all errors?

2004-02-25 Thread Paul, R. Chip
There's a parameter or setting somewhere that controls whether to return
only the first error, or all the errors in the javascript alert window.

Sorry I don't have the exact name handy.

Chip

-Original Message-
From: Mike Millson [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 25, 2004 12:58 PM
To: Struts Users
Subject: Bug in Validator javascript, not showing all errors?


I have a form with 1 text field and 1 password field:
username: required and maxlength 10
password: required

The return statement for the validateLoginForm function generated in the
dynamic javascript:

return validateMaxLength(form)  validateRequired(form); 

If I enter a username that is too long, validateMaxLength returns false, so
validateRequired is never evaluated. The result is that only the error about
username being too long is displayed, even if password is empty.

This is not how it works on the server side. If I disable javascript and
submit, the server side displays both errors: username too long and password
required.

Is this a bug? Why aren't the client side and server side validation results
equal?

Thank you,
Mike


-
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: Bug in Validator javascript, not showing all errors?

2004-02-25 Thread russo


File = struts-config.xml  Validator plugin elements:
  plug-in className=org.apache.struts.validator.ValidatorPlugIn
set-property property=pathnames
   value=/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml/
set-property property=stopOnFirstError value=false/
  /plug-in

File = login.jsp  form declaration:
...
html:form action=console onsubmit=return validate[BLAH](this)
...

Where [BLAH] is the name of the action which handles your form submition.

I'm a newbie, so if there's a better way fire away people.
-Ryan

On Wed, 25 Feb 2004, Mike Millson wrote:

 I have a form with 1 text field and 1 password field:
 username: required and maxlength 10
 password: required

 The return statement for the validateLoginForm function generated in the
 dynamic javascript:

 return validateMaxLength(form)  validateRequired(form);

 If I enter a username that is too long, validateMaxLength returns false, so 
 validateRequired is never evaluated. The result is that only the error about 
 username being too long is displayed, even if password is empty.

 This is not how it works on the server side. If I disable javascript and submit, the 
 server side displays both errors: username too long and password required.

 Is this a bug? Why aren't the client side and server side validation
 results equal?

 Thank you,
 Mike


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



|--|
| Ryan Russo   |
| [EMAIL PROTECTED]|
| University at Albany--Computing  |
| remove [noSPAM] to e-mail|
| Technical Services Web Team  |
|__|

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



Re: Bug in Validator javascript, not showing all errors?

2004-02-25 Thread Mike Millson
Thank you. And if I understand correctly, this feature is not available
in the latest release build, v1.1. I guess I have to wait until v1.2
comes out?

On Wed, 2004-02-25 at 14:18, [EMAIL PROTECTED] wrote:
 File = struts-config.xml  Validator plugin elements:
   plug-in className=org.apache.struts.validator.ValidatorPlugIn
 set-property property=pathnames
value=/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml/
 set-property property=stopOnFirstError value=false/
   /plug-in
 
 File = login.jsp  form declaration:
 ...
 html:form action=console onsubmit=return validate[BLAH](this)
 ...
 
 Where [BLAH] is the name of the action which handles your form submition.
 
 I'm a newbie, so if there's a better way fire away people.
 -Ryan
 
 On Wed, 25 Feb 2004, Mike Millson wrote:
 
  I have a form with 1 text field and 1 password field:
  username: required and maxlength 10
  password: required
 
  The return statement for the validateLoginForm function generated in the
  dynamic javascript:
 
  return validateMaxLength(form)  validateRequired(form);
 
  If I enter a username that is too long, validateMaxLength returns false, so 
  validateRequired is never evaluated. The result is that only the error about 
  username being too long is displayed, even if password is empty.
 
  This is not how it works on the server side. If I disable javascript and submit, 
  the server side displays both errors: username too long and password required.
 
  Is this a bug? Why aren't the client side and server side validation
  results equal?
 
  Thank you,
  Mike
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 |--|
 | Ryan Russo   |
 | [EMAIL PROTECTED]|
 | University at Albany--Computing  |
 | remove [noSPAM] to e-mail|
 | Technical Services Web Team  |
 |__|
 
 -
 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: Bug in Validator javascript, not showing all errors?

2004-02-25 Thread russo
Hi Mike:

 Thank you. And if I understand correctly, this feature is not available
 in the latest release build, v1.1. I guess I have to wait until v1.2
 comes out?

I'm using stable release of Struts 1.1

I assume you changed your calls to specific Validator functions to the
wrapper function built by Validator and named the way I specified?

To the best of my limited knowledge you shouldn't be calling the
individual Validator functions. Unless you're doing something special?

See my complete index.jsp below sig

In my app I have:
 LoginForm.java (extends ValidatorForm)

If that's not helping give me an idea of where you're still having problems.
-Ryan

File = index.jsp:
html
head
meta http-equiv=Content-Type content=text/html; charset=windows-1252
link href=lib/style.css rel=stylesheet type=text/css
titlebean:message key=index.title //title

html:javascript formName=loginForm/

/head
body bgcolor=White
  html:form action=console onsubmit=return validateLoginForm(this)
table cellspacing=0 cellpadding=3 border=0 width=60%
  trtd colspan=3img src=images/afr.jpg width=514
height=110 alt=bean:message key=index.title //td/tr
  tr
td align=rightUser Name/td
td
  html:text property=userid/html:text
/td
td rowspan=3html:errors //td
  /tr
  tr
td align=rightPassword/td
td
  html:password property=passwd/html:password
/td
  /tr
  tr
tdnbsp;/td
td
  html:submit/html:submit
/td
  /tr
/table
  /html:form
/body
/html

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



Re: Bug in Validator javascript, not showing all errors?

2004-02-25 Thread russo
Sorry:
 I missed the declarations at the top of my index.jsp
The following precedes the html tag:

%@ page session=false %
%@ page contentType=text/html;charset=windows-1252%
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html%
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %


-Ryan

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



Re: Bug in Validator javascript, not showing all errors?

2004-02-25 Thread Mike Millson
On Wed, 2004-02-25 at 15:20, [EMAIL PROTECTED] wrote:
 Hi Mike:
 
  Thank you. And if I understand correctly, this feature is not available
  in the latest release build, v1.1. I guess I have to wait until v1.2
  comes out?
 
 I'm using stable release of Struts 1.1

I found that you can set this property on v1.1, but it doesn't do
anything. Have you verified that you get both maxlength and required
errors at the same time in one alert box?

 
 I assume you changed your calls to specific Validator functions to the
 wrapper function built by Validator and named the way I specified?

Yes. In your example below, if you do a view source on index.jsp you
will see javascript function called validateLoginForm. If userid is
required and has a maxlength and passwd is required, the return
statement for validateLoginForm will be: return validateMaxLength(form)
 validateRequired(form).

So, it will only show the maxlength error or the required errors, but
not both.

 
 To the best of my limited knowledge you shouldn't be calling the
 individual Validator functions. Unless you're doing something special?
 
 See my complete index.jsp below sig
 
 In my app I have:
  LoginForm.java (extends ValidatorForm)
 
 If that's not helping give me an idea of where you're still having problems.
 -Ryan
 
 File = index.jsp:
 html
 head
 meta http-equiv=Content-Type content=text/html; charset=windows-1252
 link href=lib/style.css rel=stylesheet type=text/css
 titlebean:message key=index.title //title
 
 html:javascript formName=loginForm/
 
 /head
 body bgcolor=White
   html:form action=console onsubmit=return validateLoginForm(this)
 table cellspacing=0 cellpadding=3 border=0 width=60%
   trtd colspan=3img src=images/afr.jpg width=514
 height=110 alt=bean:message key=index.title //td/tr
   tr
 td align=rightUser Name/td
 td
   html:text property=userid/html:text
 /td
 td rowspan=3html:errors //td
   /tr
   tr
 td align=rightPassword/td
 td
   html:password property=passwd/html:password
 /td
   /tr
   tr
 tdnbsp;/td
 td
   html:submit/html:submit
 /td
   /tr
 /table
   /html:form
 /body
 /html
 
 -
 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: Bug in Validator javascript, not showing all errors?

2004-02-25 Thread russo
Mike:
I see what you're saying now.

It's only showing all the errors of the same type at any one time
dependending on the order the Validator functions are called.

Sorry for the confusion.
-Ryan ( ---darn newbies )

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



validator + pre processing before foward

2004-02-21 Thread Felipe Nascimento
Hi all,

I am using struts validator.
I have a form that needs a object in the request to populate some bean:write
outputs and some form input elements values.
When I submit this form to an action mapping that has validate=true and the
validation is not successfull, the user returns to the original page with
the form, but my object is not in the request anymore, naturally. Is there a
way to use validator and still be able to set a object in the request (or do
something) before the user is forwarded to getInputForward()??

For  now, I have disabled validator for this action and I am validating
inside my action execute() method. (I use dyna action forms, that´s why I
don´t use form.validate() ).

Any suggestion??

tks
Felipe




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



Validator Order with custom validations

2004-02-20 Thread Ameer Ahmed
Hi All, 
I have the following setup for validating certain fields. I have written a custom 
validator for validating certain date logic.
 
validation-rules.xml
 
validator name=xxxDates
  classname=com.xxxValidator
  method=validatexxxDates
  methodParams=java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest
  msg=errors.date.lessthanequal
/validator
 
validator.xml
 
field property=presentationStart  depends=required,date,xxxDates
 arg0 key=presentationStart/
 var
  var-namedatePatternStrict/var-name
  var-valueMM/dd//var-value
  var-namesecondProperty/var-name
  var-valuepresentationEnd/var-value
 /var
 /field 
  field property=presentationEnd  depends=required,date,xxxDates
 arg0 key=presentationEnd/
 var
  var-namedatePatternStrict/var-name
  var-valueMM/dd//var-value
  var-namesecondProperty/var-name
  var-valuepresentationStart/var-value
 /var
 /field
 
and on my jsp
html:form  action=/propertyOffer onsubmit=return validatePropertyFormBean(this);
html:text property=presentationStart size=20  /
html:text property=presentationEnd size=20  /

html:javascript formName=propertyFormBean/
 
Ok this works like a charm, if i submit the form without any values i get a javascript 
popup alert saying presentationStart is required, presentationEnd is required. 
However, when i put a value in presentationStart and submit i dont get a js popup for 
presentationEnd, however the validation runs and i get a server side error saying 
presentationEnd is required. So my question is when you put in a custom validator for 
one of the fields why doesnt it evaluate the required validation (javascript) for the 
2nd field? is this a bug? Any help would be appreciated. If i remove my custom 
validator(xxxDates) from both fields, the js required pop up runs smoothly for the 2nd 
field if the first one is not null. So to recap when you put in a custom validator for 
one of the fields the validator doesn't run through the rest of the fields until it 
has performed the serverside validation on the custom validator for the 1st field. I 
am using struts 1.1 with validator as plug-in
 
Ameer
 


-
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.

Validator and DispatchAction

2004-02-18 Thread Renato Romano
I'm quite new to the validator framework, and was trying to figure out
how to use it. My situation is:
1) I want to perform server side validation, and so I made my form
extend ValidatorForm;
2) the action that processes my form is a DispatchAction, so I have
methods like edit, save list, all associated with the same form;
3) I call http://blabla/myapp/myAction.do?methodName=edit to have the
app present me with an empty form;
4) When processing this action, struts allocates the form and calls the
validate method, which of course causes validation errors to be
produced, and the request to be forwarded to the input element of my
action, which, as usual, is the same jsp which contains the form;
5) since the page finds some errors (the form is empty!!) they are shown
by the html:errors/ tag.

The only think I can imagine is to have a separate action in
struts-config, which takes no form and simply redirects control to the
jsp page which shows the (html) form. This should avoid Struts from
calling the validate method, and hence html:errors/ should show
nothing.

Of course this would change a bit the logic we already placed in the
application actions: for example action.do?methodName=edit in our
architecture should present an empty form, while action.do?m=editid=88
should fill the form with the properties of the object with id 88, and
then forward to the same jsp page, which then shows that object ready to
be modified. If my above consideration is correct I should define two
separate actions in struts-config, and let the links be something like
newObject.do (for the presentation of an empty form) and unchanged for
the loading of an object.

Is all this correct ?Are there alternative approaches? Should I quit
server side validation and only use client-side (which does not suffer
from this problem)?
Any help is very appreciated.

Renato


Renato Romano
Sistemi e Telematica S.p.A.
Calata Grazie - Vial Al Molo Giano
16127 - GENOVA

e-mail: [EMAIL PROTECTED]
Tel.:   010 2712603
_



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



RE: Validator / Tiles and modules - anybody done it?

2004-02-18 Thread Hibbs, David
I highly recommend specifying the validator plugin in each module's
config file. It will save you much pain later on for a minimum of effort.
Each module can refer to the same validator rules and form files without
problem.  And, after all, it's 5 minutes at the most to copy/paste it to
each module once you have the first one working.

BTW, a couple things I didn't mention.  

1) Make sure to keep your jsps, js, etc etc grouped together by
module name--and MaKe SURE thaT yOur CASE MATCHES, or you'll have trouble
with the struts:html tags such as rewrite later.
2) Keep in mind that the paths in your tile definitions are ALWAYS
relative to the context root, not the module root.  If you have a tile def
myTile with a jsp stored under MyWAR/module1/jsp/myTileJsp.jsp, the path in
the tiles-defs.xml is /module1/jsp/myTileJsp.jsp -- you probably already
knew this, though. =)

David Hibbs, ACS
Staff Programmer / Analyst
American National Insurance Company


 -Original Message-
 From: Bill Johnson [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, February 17, 2004 11:25 PM
 To: Struts Users Mailing List
 Subject: RE: Validator / Tiles and modules - anybody done it?
 
 
 Thanks for the info David. One last question.  Do you
 have to have the Validator plugin in every module's
 Struts config file if you simply want to have the same
 validation file for all modules?  Can I just put the
 validator plugin definition in the default module's
 struts-config.xml and then all of the other modules
 get it by default?
 
 Thanks, Bill
 
 
 --- Hibbs, David [EMAIL PROTECTED] wrote:
   I'm curious if anyone out there has gotten
  Validator
   and/or Tiles working with Struts modules? Here are
  my
   questions.  If you can answer any of them it would
  be
   a great help.
  
  Yep.  Got 'em both working.
   
   Do you have to have the validator plugin defined
  in
   each module config file?  If so, how?
  
  You've got it--it works just like in a
  single-module app.  Create a
  separate forms.xml for each module and set it in the
  plugin and you're off.
  
   Do you have to have the tiles plugin defined in
  each
   module config file? If so, how?
  
  Again, on the money.  In each module's config,
  define the tiles
  plugin just as you would for a no-module app. 
  Here's the gotcha that I ran into.  IIRC, the docs
  indicate that the
  default is for the tiles plugin to be module aware. 
  The docs were wrong.
  You MUST include set-property
  property=moduleAware value=true / in the
  plugin definition of each module.   
  
   Any gotchas or things to know?
  
  If you see messages on the console about Plugin
  already
  initialized see the above--make sure you make ALL
  module tiles plugins
  module aware.
  
  Once you get past that problem, it's really pretty
  straightforward.
  
  David Hibbs, ACS
  Staff Programmer / Analyst
  American National Insurance Company
  
  
  
 
 -
  To unsubscribe, e-mail:
  [EMAIL PROTECTED]
  For additional commands, e-mail:
  [EMAIL PROTECTED]
  
 
 
 __
 Do you Yahoo!?
 Yahoo! Mail SpamGuard - Read only the mail you want.
 http://antispam.yahoo.com/tools
 

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



Re: Validator and DispatchAction

2004-02-18 Thread Carl Walker
I ran into the same problem and converted all my DispatchActions to
Actions.  The downside is that there are more class files, but the mappings
seem cleaner, especially in handling the 'input' attribute for html:errors
/.

Also, using Actions lets me specify different values for the 'validate'
attribute.  For example, I use the same form to lookup a records as I do to
update it.  In the case of the lookup, the Action pulls an identifier from
the DynaActionForm that doesn't need to be validated (validate=false for
this mapping).  In the case of the update, full validation of all fields is
required, so validate=true for this one.

Renato Romano wrote:

 I'm quite new to the validator framework, and was trying to figure out
 how to use it. My situation is:
 1) I want to perform server side validation, and so I made my form
 extend ValidatorForm;
 2) the action that processes my form is a DispatchAction, so I have
 methods like edit, save list, all associated with the same form;
 3) I call http://blabla/myapp/myAction.do?methodName=edit to have the
 app present me with an empty form;
 4) When processing this action, struts allocates the form and calls the
 validate method, which of course causes validation errors to be
 produced, and the request to be forwarded to the input element of my
 action, which, as usual, is the same jsp which contains the form;
 5) since the page finds some errors (the form is empty!!) they are shown
 by the html:errors/ tag.

 The only think I can imagine is to have a separate action in
 struts-config, which takes no form and simply redirects control to the
 jsp page which shows the (html) form. This should avoid Struts from
 calling the validate method, and hence html:errors/ should show
 nothing.

 Of course this would change a bit the logic we already placed in the
 application actions: for example action.do?methodName=edit in our
 architecture should present an empty form, while action.do?m=editid=88
 should fill the form with the properties of the object with id 88, and
 then forward to the same jsp page, which then shows that object ready to
 be modified. If my above consideration is correct I should define two
 separate actions in struts-config, and let the links be something like
 newObject.do (for the presentation of an empty form) and unchanged for
 the loading of an object.

 Is all this correct ?Are there alternative approaches? Should I quit
 server side validation and only use client-side (which does not suffer
 from this problem)?
 Any help is very appreciated.

 Renato

 
 Renato Romano
 Sistemi e Telematica S.p.A.
 Calata Grazie - Vial Al Molo Giano
 16127 - GENOVA

 e-mail: [EMAIL PROTECTED]
 Tel.:   010 2712603
 _

 -
 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: Validator and DispatchAction

2004-02-18 Thread Renato Romano
That's just what I supposed. DispatchAction are fine, but when you need
finer control Action fits best!! Maybe next time ;-))
Thanks anyway

Renato


Renato Romano
Sistemi e Telematica S.p.A.
Calata Grazie - Vial Al Molo Giano
16127 - GENOVA

e-mail: [EMAIL PROTECTED]
Tel.:   010 2712603
_


-Original Message-
From: Carl Walker [mailto:[EMAIL PROTECTED] 
Sent: mercoledì 18 febbraio 2004 16.43
To: Struts Users Mailing List
Subject: Re: Validator and DispatchAction


I ran into the same problem and converted all my DispatchActions to
Actions.  The downside is that there are more class files, but the
mappings seem cleaner, especially in handling the 'input' attribute for
html:errors /.

Also, using Actions lets me specify different values for the 'validate'
attribute.  For example, I use the same form to lookup a records as I do
to update it.  In the case of the lookup, the Action pulls an identifier
from the DynaActionForm that doesn't need to be validated
(validate=false for this mapping).  In the case of the update, full
validation of all fields is required, so validate=true for this one.

Renato Romano wrote:

 I'm quite new to the validator framework, and was trying to figure out

 how to use it. My situation is:
 1) I want to perform server side validation, and so I made my form 
 extend ValidatorForm;
 2) the action that processes my form is a DispatchAction, so I have 
 methods like edit, save list, all associated with the same form;
 3) I call http://blabla/myapp/myAction.do?methodName=edit to have the 
 app present me with an empty form;
 4) When processing this action, struts allocates the form and calls 
 the validate method, which of course causes validation errors to be 
 produced, and the request to be forwarded to the input element of my

 action, which, as usual, is the same jsp which contains the form;
 5) since the page finds some errors (the form is empty!!) they are 
 shown by the html:errors/ tag.

 The only think I can imagine is to have a separate action in 
 struts-config, which takes no form and simply redirects control to the

 jsp page which shows the (html) form. This should avoid Struts from 
 calling the validate method, and hence html:errors/ should show 
 nothing.

 Of course this would change a bit the logic we already placed in the 
 application actions: for example action.do?methodName=edit in our 
 architecture should present an empty form, while 
 action.do?m=editid=88 should fill the form with the properties of the

 object with id 88, and then forward to the same jsp page, which then 
 shows that object ready to be modified. If my above consideration is 
 correct I should define two separate actions in struts-config, and let

 the links be something like newObject.do (for the presentation of an 
 empty form) and unchanged for the loading of an object.

 Is all this correct ?Are there alternative approaches? Should I quit 
 server side validation and only use client-side (which does not suffer

 from this problem)? Any help is very appreciated.

 Renato

 
 Renato Romano
 Sistemi e Telematica S.p.A.
 Calata Grazie - Vial Al Molo Giano
 16127 - GENOVA

 e-mail: [EMAIL PROTECTED]
 Tel.:   010 2712603
 _

 -
 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: Validator and DispatchAction

2004-02-18 Thread Barnett, Brian W.
Set validate=false in your action mapping in struts-config. This tells the
struts framework not to call validate. Then in your action class you can
call validate where appropriate, i.e., the *save* method.

-Original Message-
From: Renato Romano [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 18, 2004 6:43 AM
To: 'Struts Users Mailing List'
Subject: Validator and DispatchAction

I'm quite new to the validator framework, and was trying to figure out
how to use it. My situation is:
1) I want to perform server side validation, and so I made my form
extend ValidatorForm;
2) the action that processes my form is a DispatchAction, so I have
methods like edit, save list, all associated with the same form;
3) I call http://blabla/myapp/myAction.do?methodName=edit to have the
app present me with an empty form;
4) When processing this action, struts allocates the form and calls the
validate method, which of course causes validation errors to be
produced, and the request to be forwarded to the input element of my
action, which, as usual, is the same jsp which contains the form;
5) since the page finds some errors (the form is empty!!) they are shown
by the html:errors/ tag.

The only think I can imagine is to have a separate action in
struts-config, which takes no form and simply redirects control to the
jsp page which shows the (html) form. This should avoid Struts from
calling the validate method, and hence html:errors/ should show
nothing.

Of course this would change a bit the logic we already placed in the
application actions: for example action.do?methodName=edit in our
architecture should present an empty form, while action.do?m=editid=88
should fill the form with the properties of the object with id 88, and
then forward to the same jsp page, which then shows that object ready to
be modified. If my above consideration is correct I should define two
separate actions in struts-config, and let the links be something like
newObject.do (for the presentation of an empty form) and unchanged for
the loading of an object.

Is all this correct ?Are there alternative approaches? Should I quit
server side validation and only use client-side (which does not suffer
from this problem)?
Any help is very appreciated.

Renato


Renato Romano
Sistemi e Telematica S.p.A.
Calata Grazie - Vial Al Molo Giano
16127 - GENOVA

e-mail: [EMAIL PROTECTED]
Tel.:   010 2712603
_



-
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: Validator and DispatchAction

2004-02-18 Thread Nicholas L Mohler





Renato,

There is another solution that is clean.

We use one action class with multiple (3) mappings to support our
validation needs.  With our editor scheme, the user proceeds to a Top
page where they decide to Edit an existing or Add a new item.  They then
proceed to a Detail page where they build the item.  The validations for
the Top and Detail pages are different, and we use the same form for both.
We want our server side validation failures to return to the page that
caused the failure.  For the Top page, that is not an issue, since there is
only one possible page that could have caused the validation issue.  We had
to address the Edit and Add pages.

For this, we have three mappings:
Top - Handles initial requests for the Top page and actions from the Top
page.  In this case, the input attribute always returns to the same page.
This mapping uses Top validations.
Detail - Handles requests that originate from a detail page.  This mapping
uses Detail validations.  In this case, the input attribute always
points to the third mapping: ValidationFailure.  We additionally add a new
attribute that points to a specialized method in the action class.
ValidationFailure - Handles requests where the detail validation failed.
Uses a different parameter for the DispatchAction than the other two
methods.  Validation is set to false.  The available forwards are the same
as the Edit and Add forwards that are found in the Top mapping.

When the failure method is used, it takes care of any prep work that is
needed to return to the detail page.  For example, there are some DB values
that we put into the request (they should be in the session, but that's
another story) when we go to the page.  The failure method handles any of
the necessary prep work.  The last task is that we retrieve the parameter
that was used for the original DispatchAction and return the mapping that
will take us back to the page that caused the error.

In our case, we use LookupDispatchAction classes, and this works well and
is pretty neat.  Additionally, all of our action classes extend a custom
LookupDispatchAction class that implements the failure method as well as
a few other things that are generic for all of action classes.

Let me know if this helps.
Nick




|-+
| |   Renato Romano  |
| |   [EMAIL PROTECTED]|
| |   work.com|
| ||
| |   02/18/2004 11:18 |
| |   AM   |
| |   Please respond to|
| |   Struts Users|
| |   Mailing List|
| ||
|-+
  
--|
  |
  |
  |   To:   'Struts Users Mailing List' [EMAIL PROTECTED]  
 |
  |   cc:  
  |
  |   Subject:  RE: Validator and DispatchAction   
  |
  
--|




That's just what I supposed. DispatchAction are fine, but when you need
finer control Action fits best!! Maybe next time ;-))
Thanks anyway

Renato


Renato Romano
Sistemi e Telematica S.p.A.
Calata Grazie - Vial Al Molo Giano
16127 - GENOVA

e-mail: [EMAIL PROTECTED]
Tel.:   010 2712603
_


-Original Message-
From: Carl Walker [mailto:[EMAIL PROTECTED]
Sent: mercoledì 18 febbraio 2004 16.43
To: Struts Users Mailing List
Subject: Re: Validator and DispatchAction


I ran into the same problem and converted all my DispatchActions to
Actions.  The downside is that there are more class files, but the
mappings seem cleaner, especially in handling the 'input' attribute for
html:errors /.

Also, using Actions lets me specify different values for the 'validate'
attribute.  For example, I use the same form to lookup a records as I do
to update it.  In the case of the lookup, the Action pulls an identifier
from the DynaActionForm that doesn't need to be validated
(validate=false for this mapping).  In the case of the update, full
validation of all fields is required, so validate=true for this one.

Renato Romano wrote:

 I'm quite new to the validator framework, and was trying to figure out

 how to use it. My situation is:
 1) I want to perform server side validation, and so I made my form
 extend ValidatorForm;
 2) the action that processes my form is a DispatchAction, so

Validator Framework question

2004-02-17 Thread Simon Pett
Hi 

As I use the validator framework I'm reading the mail archive and I have
come across a few comments like One more reason to use Strings for all
ActionForm properties? though I haven't found a good discussion on why.

Is this piece of advice still current, can someone point me in the direction
of a good thread covering the problems with the use of other types,
Integer's Float's Date's etc in ActionForms or more importantly
DynaValidatorForm's 

Thanks
Simon


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



Validator / Tiles and modules - anybody done it?

2004-02-17 Thread Bill Johnson
I'm curious if anyone out there has gotten Validator
and/or Tiles working with Struts modules? Here are my
questions.  If you can answer any of them it would be
a great help.

Do you have to have the validator plugin defined in
each module config file?  If so, how?

Do you have to have the tiles plugin defined in each
module config file? If so, how?

Any gotchas or things to know?

Thanks,

Bill

__
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

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



RE: Validator / Tiles and modules - anybody done it?

2004-02-17 Thread Hibbs, David
 I'm curious if anyone out there has gotten Validator
 and/or Tiles working with Struts modules? Here are my
 questions.  If you can answer any of them it would be
 a great help.

Yep.  Got 'em both working.
 
 Do you have to have the validator plugin defined in
 each module config file?  If so, how?

You've got it--it works just like in a single-module app.  Create a
separate forms.xml for each module and set it in the plugin and you're off.

 Do you have to have the tiles plugin defined in each
 module config file? If so, how?

Again, on the money.  In each module's config, define the tiles
plugin just as you would for a no-module app. 
Here's the gotcha that I ran into.  IIRC, the docs indicate that the
default is for the tiles plugin to be module aware.  The docs were wrong.
You MUST include set-property property=moduleAware value=true / in the
plugin definition of each module.   

 Any gotchas or things to know?

If you see messages on the console about Plugin already
initialized see the above--make sure you make ALL module tiles plugins
module aware.

Once you get past that problem, it's really pretty straightforward.

David Hibbs, ACS
Staff Programmer / Analyst
American National Insurance Company



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



RE: Validator / Tiles and modules - anybody done it?

2004-02-17 Thread Bill Johnson
Thanks for the info David. One last question.  Do you
have to have the Validator plugin in every module's
Struts config file if you simply want to have the same
validation file for all modules?  Can I just put the
validator plugin definition in the default module's
struts-config.xml and then all of the other modules
get it by default?

Thanks, Bill


--- Hibbs, David [EMAIL PROTECTED] wrote:
  I'm curious if anyone out there has gotten
 Validator
  and/or Tiles working with Struts modules? Here are
 my
  questions.  If you can answer any of them it would
 be
  a great help.
 
   Yep.  Got 'em both working.
  
  Do you have to have the validator plugin defined
 in
  each module config file?  If so, how?
 
   You've got it--it works just like in a
 single-module app.  Create a
 separate forms.xml for each module and set it in the
 plugin and you're off.
 
  Do you have to have the tiles plugin defined in
 each
  module config file? If so, how?
 
   Again, on the money.  In each module's config,
 define the tiles
 plugin just as you would for a no-module app. 
   Here's the gotcha that I ran into.  IIRC, the docs
 indicate that the
 default is for the tiles plugin to be module aware. 
 The docs were wrong.
 You MUST include set-property
 property=moduleAware value=true / in the
 plugin definition of each module.   
 
  Any gotchas or things to know?
 
   If you see messages on the console about Plugin
 already
 initialized see the above--make sure you make ALL
 module tiles plugins
 module aware.
 
   Once you get past that problem, it's really pretty
 straightforward.
 
 David Hibbs, ACS
 Staff Programmer / Analyst
 American National Insurance Company
 
 
 

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


__
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools

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



Separating Strut and Validator errors

2004-02-16 Thread Theodosios Paschalidis
Hi all,

a quick newbie question. 
When I use an ActionError in my Action class in conjuction with the Validator, I get 
all my errors reported as server side validations (i.e. no java script).

I have found the following code in the book Struts In Action to handle that but I 
guess it's depreciated... I searched over the web for a way to achieve the same but 
with no luck. Does anybody know what replaced the logic:messages tag or a way to 
achieve the same? 

Thank you for your time,
Theo


logic:messagesPresent
UL
logic:messages id=error
LI bean:write name=errors/ /LI
/logic:messages
/UL
/logic:messagesPresent


Re: Separating Strut and Validator errors

2004-02-16 Thread Niall Pemberton
http://jakarta.apache.org/struts/userGuide/struts-html.html#errors
http://jakarta.apache.org/struts/userGuide/struts-html.html#messages



- Original Message - 
From: Theodosios Paschalidis [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, February 16, 2004 10:41 PM
Subject: Separating Strut and Validator errors


Hi all,

a quick newbie question.
When I use an ActionError in my Action class in conjuction with the
Validator, I get all my errors reported as server side validations (i.e. no
java script).

I have found the following code in the book Struts In Action to handle
that but I guess it's depreciated... I searched over the web for a way to
achieve the same but with no luck. Does anybody know what replaced the
logic:messages tag or a way to achieve the same?

Thank you for your time,
Theo


logic:messagesPresent
UL
logic:messages id=error
LI bean:write name=errors/ /LI
/logic:messages
/UL
/logic:messagesPresent



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



Dyna Validator Form values

2004-02-12 Thread Darren Massel
 How do i reset the values of a Dyna Validator form that is in the session?
So that when i link back to that form once it has been submitted the values
are blank.

In the Action 
form.reset(..) and form.set(String, ) had no affect.


form-bean name=acoSummaryInitForm
type=org.apache.struts.validator.DynaValidatorForm
form-property initial= name=date
type=java.lang.String/
form-property initial= name=shift
type=java.lang.String/
/form-bean


action path=/acoSummaryInit
 
type=com.cedar.turnout.struts.ACOSummaryInitAction
forward name=success
path=/pages/ACOSummary.jsp /
/action

cheers.


*** 
This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they 
are addressed. Any unauthorised distribution or copying is strictly 
prohibited. 
 
Whilst Cedar Software Ltd takes steps to prevent the transmission of 
viruses via e-mail, we can not guarantee that any email or 
attachment is free from computer viruses and you are strongly 
advised to undertake your own anti-virus precautions. 
 
Cedar Software Ltd grants no warranties regarding performance, 
use or quality of any e-mail or attachment and undertakes no 
liability for loss or damage, howsoever caused. 

CedAr is a leading UK supplier of Financial, eProcurement, Performance Management and, 
following the recent acquisition of Goldenhill Computer Systems Ltd, HR and Payroll 
software. Cedars solutions deliver increased capabilities and offer a direct and 
measurable financial return on investment.  The company has a customer base of more 
than 500 organisations in both the public and private sector. 
Particular sector strengths include Airlines, Business Services,
Education, Emergency Services, Financial Services, Government, Health, Local 
Authorities, Not for Profit, Retail and Utilities.  For more
information, please visit www.cedar.com 
2003 CedAr Software Ltd. All Rights Reserved. 
Cedar Software Ltd. Incorporation number 3214465
 ***


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



Dyna Validator Form values

2004-02-12 Thread Darren Massel


 How do i reset the values of a Dyna Validator form that is in the session?
So that when i link back to that form once it has been submitted the values
are blank.

In the Action 
form.reset(..) and form.set(String, ) 
 
intial= in the form definition

...had no affect.

cheers.


*** 
This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they 
are addressed. Any unauthorised distribution or copying is strictly 
prohibited. 
 
Whilst Cedar Software Ltd takes steps to prevent the transmission of 
viruses via e-mail, we can not guarantee that any email or 
attachment is free from computer viruses and you are strongly 
advised to undertake your own anti-virus precautions. 
 
Cedar Software Ltd grants no warranties regarding performance, 
use or quality of any e-mail or attachment and undertakes no 
liability for loss or damage, howsoever caused. 

CedAr is a leading UK supplier of Financial, eProcurement, Performance Management and, 
following the recent acquisition of Goldenhill Computer Systems Ltd, HR and Payroll 
software. Cedars solutions deliver increased capabilities and offer a direct and 
measurable financial return on investment.  The company has a customer base of more 
than 500 organisations in both the public and private sector. 
Particular sector strengths include Airlines, Business Services,
Education, Emergency Services, Financial Services, Government, Health, Local 
Authorities, Not for Profit, Retail and Utilities.  For more
information, please visit www.cedar.com 
2003 CedAr Software Ltd. All Rights Reserved. 
Cedar Software Ltd. Incorporation number 3214465
 ***


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



RE: Dyna Validator Form values

2004-02-12 Thread Matthias Wessendorf
hi,

perhaps you mean
request.getSession().removeAttribute(nameOfFormBean);

cheers,

-Original Message-
From: Darren Massel [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 12, 2004 7:08 PM
To: '[EMAIL PROTECTED]'
Subject: Dyna Validator Form values




 How do i reset the values of a Dyna Validator form that is in the
session? So that when i link back to that form once it has been
submitted the values are blank.

In the Action 
form.reset(..) and form.set(String, ) 
 
intial= in the form definition

...had no affect.

cheers.


*** 
This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they 
are addressed. Any unauthorised distribution or copying is strictly 
prohibited. 
 
Whilst Cedar Software Ltd takes steps to prevent the transmission of 
viruses via e-mail, we can not guarantee that any email or 
attachment is free from computer viruses and you are strongly 
advised to undertake your own anti-virus precautions. 
 
Cedar Software Ltd grants no warranties regarding performance, 
use or quality of any e-mail or attachment and undertakes no 
liability for loss or damage, howsoever caused. 

CedAr is a leading UK supplier of Financial, eProcurement, Performance
Management and, following the recent acquisition of Goldenhill Computer
Systems Ltd, HR and Payroll software. Cedars solutions deliver increased
capabilities and offer a direct and measurable financial return on
investment.  The company has a customer base of more than 500
organisations in both the public and private sector. 
Particular sector strengths include Airlines, Business Services,
Education, Emergency Services, Financial Services, Government, Health,
Local Authorities, Not for Profit, Retail and Utilities.  For more
information, please visit www.cedar.com 
2003 CedAr Software Ltd. All Rights Reserved. 
Cedar Software Ltd. Incorporation number 3214465
 ***


-
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: Dyna Validator Form values

2004-02-12 Thread Wendy Smoak
 From: Darren Massel [mailto:[EMAIL PROTECTED] 
 How do i reset the values of a Dyna Validator form that is 
 in the session?

The 'initialize' method is inherited from DynaActionForm:

http://jakarta.apache.org/struts/api/org/apache/struts/action/DynaActio
nForm.html#initialize(org.apache.struts.action.ActionMapping)

public void initialize(ActionMapping mapping)

Initialize all bean properties to their initial values, as specified in
the FormPropertyConfig elements associated with the definition of this
DynaActionForm.

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 

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



RE: Need help on making Custom Validator work

2004-02-12 Thread Pingili, Madhupal
Hi All,
I tried with plain html file to be displayed when validation fails.
I am still getting following message:
DEBUG (RequestProcessor.java:972) -  Validation failed, 
returning to '/Logon.html'

Browser just hangs. 

What does the RequestProcessor do after above message?
I am using DynaValidatorActionForm at request scope.

Does the RequestProcessor try to set the fields in my form to the values
that it had 
received before validation failed?

If so, how can I check there is no error in this process?

Thanks for any hints/links/help.

Reddy Pingili 


 -Original Message-
 From: Pingili, Madhupal 
 Sent: Wednesday, February 11, 2004 2:19 PM
 To:   '[EMAIL PROTECTED]'
 Subject:  Need help on making Custom Validator work
 
 Hi All,
 I have developed a validator for a special validation.
 I have debug statements in this class and I enabled
 the validator and struts.action classes logging level to DEBUG.
 
 When I type an invalid field in my form and click on search button,
 the action gets invoked and I see all the messages in
 log files(from my validator class as well as struts.action classes).
 
 The last message was:
 
 DEBUG (RequestProcessor.java:972) -  Validation failed, returning to
 '/FindDocs.jsp'
 
 After this, I should get the results of 'FindDocs.jsp' in my browser
 window.
 But I am not getting any response in my browser window. It just hangs.
 
 Can anyone tell me how to find out what's happening here?
  
 'FindDocs.jsp' has folowing code just like 
 struts-validator.war web app has:
 
 logic:messagesPresent
bean:message key=errors.header/
ul
html:messages id=error
   libean:write name=error//li
/html:messages
/ulhr
 /logic:messagesPresent
 
 I am using struts 1.1 version.
 
 Reddy Pingili
 
 
 -
 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]



Need help on making Custom Validator work

2004-02-11 Thread Pingili, Madhupal
Hi All,
I have developed a validator for a special validation.
I have debug statements in this class and I enabled
the validator and struts.action classes logging level to DEBUG.

When I type an invalid field in my form and click on search button,
the action gets invoked and I see all the messages in
log files(from my validator class as well as struts.action classes).

The last message was:

DEBUG (RequestProcessor.java:972) -  Validation failed, returning to
'/FindDocs.jsp'

After this, I should get the results of 'FindDocs.jsp' in my browser window.
But I am not getting any response in my browser window. It just hangs.

Can anyone tell me how to find out what's happening here?
 
'FindDocs.jsp' has folowing code just like 
struts-validator.war web app has:

logic:messagesPresent
   bean:message key=errors.header/
   ul
   html:messages id=error
  libean:write name=error//li
   /html:messages
   /ulhr
/logic:messagesPresent

I am using struts 1.1 version.

Reddy Pingili


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



RE: Need help on making Custom Validator work

2004-02-11 Thread Navjot Singh
if it shows you just blank page then something is *null* somewhere

-Original Message-
From: Pingili, Madhupal [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 12, 2004 12:49 AM
To: '[EMAIL PROTECTED]'
Subject: Need help on making Custom Validator work


Hi All,
I have developed a validator for a special validation.
I have debug statements in this class and I enabled
the validator and struts.action classes logging level to DEBUG.

When I type an invalid field in my form and click on search button,
the action gets invoked and I see all the messages in
log files(from my validator class as well as struts.action classes).

The last message was:

DEBUG (RequestProcessor.java:972) -  Validation failed, returning to
'/FindDocs.jsp'

After this, I should get the results of 'FindDocs.jsp' in my 
browser window.
But I am not getting any response in my browser window. It just hangs.

Can anyone tell me how to find out what's happening here?
 
'FindDocs.jsp' has folowing code just like 
struts-validator.war web app has:

logic:messagesPresent
   bean:message key=errors.header/
   ul
   html:messages id=error
  libean:write name=error//li
   /html:messages
   /ulhr
/logic:messagesPresent

I am using struts 1.1 version.

Reddy Pingili


-
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: repost: validator retrieving data

2004-02-09 Thread Michele Callegari
 If there are 2 actions, one to prepare the page and 
 one to process the user input, we define the input attribute 
 value of the process action mapping to be the URL of the 
 prepare action. I think it's right,

I think it's right only in simple cases
If your prepare means:
- Putting in the request a collection for a select (for example)
- Initializing the form with data from DB or any other source
You are doing 2 things completely different (logically)
in the same action and that's why you need a workaround 
with hidden fields or hard coded path or

The cleanest solution is to separate this prepare action in 
2 actions. Too much? 
OK! Choose any other way you like! But it won't be clean.

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



  1   2   3   4   5   6   7   8   9   10   >