Re: Help:validation is not working with struts1.2

2006-05-31 Thread M.Liang Liu

Thanks to all of you.

I learned a lot from this chain of letters.

You fellows are so kind that I am sure struts is a beautiful struts :)

Many questions are coming as I will pay a lot of time to study struts as a
freshman.

Thank you again.


Re: Help:validation is not working with struts1.2

2006-05-31 Thread M Hollyer
!DOCTYPE form-validation PUBLIC
  -//Apache Software Foundation//DTD Commons Validator Rules 
Configuration 1.1.3//EN
  http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd;

I am experiencing the same issue when my network connection is off.  The 
validator cannot reference 
the http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; when there is 
no network connection.

 This is bad because validator rules won't work when this is the case.

I believe the solution is to either change 
the http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; to a local 
server reference to the validator_1_1_3.dtd or placing placing 
the validator_1_1_3.dtd in a location such as WEB-INF.

So far I do not yet have a solution.




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



Re: Help:validation is not working with struts1.2

2006-05-31 Thread Gareth Evans

Hi,

If your application tries to connect to the web for any reason on 
startup, either to jakarta.apache.org or struts.apache.org it is because 
the digester is unable to find a local copy of the dtd.


This can happen for a number of reasons:

1) There is a typo in your doctype declaration
2) You are referencing a version that does not exists

One of the best ways to check it to extract the struts jars file to a 
temporary folder and see which ones it contains.


Note: The public identifier is an exact string match i.e.

-//Apache Software Foundation//DTD Commons Validator Rules Configuration 
1.1.3//EN


is not the same as:

-//Apache Software Foundation/DTD Commons Validator Rules Configuration 
1.1.3//EN


(/ instead of //)

Gareth

M Hollyer wrote:

!DOCTYPE form-validation PUBLIC
  -//Apache Software Foundation//DTD Commons Validator Rules 
Configuration 1.1.3//EN

  http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd;

I am experiencing the same issue when my network connection is off.  The 
validator cannot reference 
the http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; when there is 
no network connection.


 This is bad because validator rules won't work when this is the case.

I believe the solution is to either change 
the http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; to a local 
server reference to the validator_1_1_3.dtd or placing placing 
the validator_1_1_3.dtd in a location such as WEB-INF.


So far I do not yet have a solution.




-
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: Help:validation is not working with struts1.2

2006-05-31 Thread M Hollyer
Gareth Evans gareth.evans at msoft.co.uk writes:

 One of the best ways to check it to extract the struts jars file to a 
 temporary folder and see which ones it contains.
 
 Note: The public identifier is an exact string match i.e.
 
 -//Apache Software Foundation//DTD Commons Validator Rules Configuration 
 1.1.3//EN
 
 is not the same as:
 
 -//Apache Software Foundation/DTD Commons Validator Rules Configuration 
 1.1.3//EN
 
 (/ instead of //)
 


This actually makes sense.  We are in the midst of upgrading struts versions 
as well as introducing the validator to our application.  I most likely used 
the dtd for 1.2 while our struts version is still 1.1.  I'll examine dtds in 
the unzipped struts.jar.

Thanks.


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



Re: Help:validation is not working with struts1.2

2006-05-30 Thread Suresh Babu S

u need to add html:javascript  tag into ur form.
did u add this 


On 5/30/06, M.Liang Liu [EMAIL PROTECTED] wrote:


I tried to use validator in my struts application and I find a problem
occurred:
 The form did not validate itself and the execute method is
always called.

I active the plug-in in struts-config.xml as following:

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

and I write the validation.xml as following:

 ?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
 global
 constant
 constant-namephone/constant-name
 constant-value^\(?(\d{3})\)?[-| ]?(\d{3})[-|
 ]?(\d{4})$/constant-value
 /constant
 constant
 constant-namezip/constant-name
 constant-value^\d{5}\d*$/constant-value
 /constant
 /global

 !-- = Default Formset
 = --
 formset
 form  name=sForm
 field  property=name  depends=required
 arg0  key=test.name/
 /field

 /form
 /formset
 /form-validation


I write the struts-config.xml as following for mapping

  action
   attribute=sForm
   input=/form/s.jsp
   name=sForm
   path=/s
   scope=request
   type=com.eam.struts.action.SAction
   validate=true
   forward name=success path=/welcome.do /
 /action



The form extends the ValidatorForm,

But it does NOT work.

Who can  help me?


Thanks a lot.

--
Why Signature?





--
---
Suresh babu S
Software Engineer
IBM,080-417 72568(Direct)
+91-9886237127
[EMAIL PROTECTED]


Re: Help:validation is not working with struts1.2

2006-05-30 Thread paz . periasamy
Suresh,

I think what Liang is using server side validation.,

Please post all the XML config files, JSP for us to debug.

Thanks and regards,
Pazhanikanthan. P (Paz)






Suresh Babu S [EMAIL PROTECTED]
30/05/2006 04:30 PM
Please respond to Struts Users Mailing List

 
To: Struts Users Mailing List user@struts.apache.org
cc: 
Subject:Re: Help:validation is not working with struts1.2


u need to add html:javascript  tag into ur form.
did u add this 


On 5/30/06, M.Liang Liu [EMAIL PROTECTED] wrote:

 I tried to use validator in my struts application and I find a problem
 occurred:
  The form did not validate itself and the execute method is
 always called.

 I active the plug-in in struts-config.xml as following:

  plug-in className=org.apache.struts.validator.ValidatorPlugIn
  set-property
  property=pathnames
  value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/
  /plug-in
 
 and I write the validation.xml as following:

  ?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
  global
  constant
  constant-namephone/constant-name
  constant-value^\(?(\d{3})\)?[-| ]?(\d{3})[-|
  ]?(\d{4})$/constant-value
  /constant
  constant
  constant-namezip/constant-name
  constant-value^\d{5}\d*$/constant-value
  /constant
  /global
 
  !-- = Default Formset
  = --
  formset
  form  name=sForm
  field  property=name  depends=required
  arg0  key=test.name/
  /field
 
  /form
  /formset
  /form-validation
 
 
 I write the struts-config.xml as following for mapping

   action
attribute=sForm
input=/form/s.jsp
name=sForm
path=/s
scope=request
type=com.eam.struts.action.SAction
validate=true
forward name=success path=/welcome.do /
  /action



 The form extends the ValidatorForm,

 But it does NOT work.

 Who can  help me?


 Thanks a lot.

 --
 Why Signature?




-- 
---
Suresh babu S
Software Engineer
IBM,080-417 72568(Direct)
+91-9886237127
[EMAIL PROTECTED]


_ 
This e-mail has been scanned for viruses by MCI's Internet Managed 
Scanning Services - powered by MessageLabs. For further information 
visit http://www.mci.com


*
Important Note
This email (including any attachments) contains information which is 
confidential and may be subject to legal privilege.  If you are not 
the intended recipient you must not use, distribute or copy this 
email.  If you have received this email in error please notify the 
sender immediately and delete this email. Any views expressed in this 
email are not necessarily the views of AXA.   Thank you.
**


Re: Help:validation is not working with struts1.2

2006-05-30 Thread M.Liang Liu

Thanks for your reply.
*paz.periasamy got the point:I am just trying to use server validate.
The validator-rules.xml is as following ,the one I copyed from the
struts-blank:
*


!DOCTYPE form-validation PUBLIC
  -//Apache Software Foundation//DTD Commons Validator Rules
Configuration 1.1.3//EN
  http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd;
!--
  $Id: validator-rules.xml 159291 2005-03-28 20:19:29Z niallp $

   This file contains the default Struts Validator pluggable validator
   definitions.  It should be placed somewhere under /WEB-INF and
   referenced in the struts-config.xml under the plug-in element
   for the ValidatorPlugIn.

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

/WEB-INF/validation.xml/
  /plug-in

   These are the default error messages associated with
   each validator defined in this file.  They should be
   added to your projects ApplicationResources.properties
   file or you can associate new ones by modifying the
   pluggable validators msg attributes in this file.

   # Struts Validator Error Messages
   errors.required={0} is required.
   errors.minlength={0} can not be less than {1} characters.
   errors.maxlength={0} can not be greater than {1} characters.
   errors.invalid={0} is invalid.

   errors.byte={0} must be a byte.
   errors.short={0} must be a short.
   errors.integer={0} must be an integer.
   errors.long={0} must be a long.
   errors.float={0} must be a float.
   errors.double={0} must be a double.

   errors.date={0} is not a date.
   errors.range={0} is not in the range {1} through {2}.
   errors.creditcard={0} is an invalid credit card number.
   errors.email={0} is an invalid e-mail address.

   Note: Starting in Struts 1.2.0 the default javascript definitions have
 been consolidated to commons-validator. The default can be
overridden
 by supplying a javascript element with a CDATA section, just as
 in struts 1.1.

--

form-validation

   global

  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,
   org.apache.commons.validator.Validator,
   javax.servlet.http.HttpServletRequest
  msg=errors.required/

  validator name=requiredif
 classname=org.apache.struts.validator.FieldChecks
 method=validateRequiredIf
 methodParams=java.lang.Object,

org.apache.commons.validator.ValidatorAction,
   org.apache.commons.validator.Field,
   org.apache.struts.action.ActionMessages,
   org.apache.commons.validator.Validator,
   javax.servlet.http.HttpServletRequest
 msg=errors.required/

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


  validator name=minlength
classname=org.apache.struts.validator.FieldChecks
   method=validateMinLength
 methodParams=java.lang.Object,
   org.apache.commons.validator.ValidatorAction,
   org.apache.commons.validator.Field,
   org.apache.struts.action.ActionMessages,
   org.apache.commons.validator.Validator,
   javax.servlet.http.HttpServletRequest
  depends=
  msg=errors.minlength
   jsFunction=
org.apache.commons.validator.javascript.validateMinLength/


  validator name=maxlength
classname=org.apache.struts.validator.FieldChecks
   method=validateMaxLength
 methodParams=java.lang.Object,
   org.apache.commons.validator.ValidatorAction,
   org.apache.commons.validator.Field,
   org.apache.struts.action.ActionMessages,
   org.apache.commons.validator.Validator,
   javax.servlet.http.HttpServletRequest
  depends=
  msg=errors.maxlength
   jsFunction=
org.apache.commons.validator.javascript.validateMaxLength/



  validator 

Re: Help:validation is not working with struts1.2

2006-05-30 Thread Suresh Babu S

The html:javascript tag to allow front-end validation based on the xml in
validation.xml. For example the code: html:javascript
formName=\logonForm\ dynamicJavascript=\true\ staticJavascript=\true\
/ generates the client side java script for the form \logonForm\ as
defined in the validation.xml file. The html:javascript when added in the
jsp file generates the client site validation script.

On 5/30/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


Suresh,

I think what Liang is using server side validation.,

Please post all the XML config files, JSP for us to debug.

Thanks and regards,
Pazhanikanthan. P (Paz)






Suresh Babu S [EMAIL PROTECTED]
30/05/2006 04:30 PM
Please respond to Struts Users Mailing List


To: Struts Users Mailing List user@struts.apache.org
cc:
Subject:Re: Help:validation is not working with struts1.2


u need to add html:javascript  tag into ur form.
did u add this 


On 5/30/06, M.Liang Liu [EMAIL PROTECTED] wrote:

 I tried to use validator in my struts application and I find a problem
 occurred:
  The form did not validate itself and the execute method is
 always called.

 I active the plug-in in struts-config.xml as following:

  plug-in className=org.apache.struts.validator.ValidatorPlugIn
  set-property
  property=pathnames
  value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/
  /plug-in
 
 and I write the validation.xml as following:

  ?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
  global
  constant
  constant-namephone/constant-name
  constant-value^\(?(\d{3})\)?[-| ]?(\d{3})[-|
  ]?(\d{4})$/constant-value
  /constant
  constant
  constant-namezip/constant-name
  constant-value^\d{5}\d*$/constant-value
  /constant
  /global
 
  !-- = Default Formset
  = --
  formset
  form  name=sForm
  field  property=name  depends=required
  arg0  key=test.name/
  /field
 
  /form
  /formset
  /form-validation
 
 
 I write the struts-config.xml as following for mapping

   action
attribute=sForm
input=/form/s.jsp
name=sForm
path=/s
scope=request
type=com.eam.struts.action.SAction
validate=true
forward name=success path=/welcome.do /
  /action



 The form extends the ValidatorForm,

 But it does NOT work.

 Who can  help me?


 Thanks a lot.

 --
 Why Signature?




--
---
Suresh babu S
Software Engineer
IBM,080-417 72568(Direct)
+91-9886237127
[EMAIL PROTECTED]


_
This e-mail has been scanned for viruses by MCI's Internet Managed
Scanning Services - powered by MessageLabs. For further information
visit http://www.mci.com



*
Important Note
This email (including any attachments) contains information which is
confidential and may be subject to legal privilege.  If you are not
the intended recipient you must not use, distribute or copy this
email.  If you have received this email in error please notify the
sender immediately and delete this email. Any views expressed in this
email are not necessarily the views of AXA.   Thank you.

**





--
---
Suresh babu S
Software Engineer
IBM,080-417 72568(Direct)
+91-9886237127
[EMAIL PROTECTED]


Re: Help:validation is not working with struts1.2

2006-05-30 Thread The Jasper

Hi,
try changing the validation to:

 form  name=/s
field  property=name  depends=required/field
  /form

note, you are now referencing the action not the page.

Also, you might want to extend ValidatorActionForm instead of
ValidatorForm, but to tell the truth I'm not sure I really understand
the difference.

You don't need the key field if you ask me, but you might want a msg
field for custom messages.

good luck with it.

mvg,
Jasper

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



RE: Help:validation is not working with struts1.2

2006-05-30 Thread Sateesh Nelluri
Hi

Remove attribute=sForm from the tag 'action'.
And try again.

  action
   attribute=sForm
   input=/form/s.jsp
   name=sForm
   path=/s
   scope=request
   type=com.eam.struts.action.SAction
   validate=true
   forward name=success path=/welcome.do /
 /action

regards
sateesh

-Original Message-
From: M.Liang Liu [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 30, 2006 10:18 AM
To: Struts Users Mailing List
Subject: Help:validation is not working with struts1.2

I tried to use validator in my struts application and I find a problem
occurred:
 The form did not validate itself and the execute method is
always called.

I active the plug-in in struts-config.xml as following:

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

and I write the validation.xml as following:

 ?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
 global
 constant
 constant-namephone/constant-name
 constant-value^\(?(\d{3})\)?[-| ]?(\d{3})[-|
 ]?(\d{4})$/constant-value
 /constant
 constant
 constant-namezip/constant-name
 constant-value^\d{5}\d*$/constant-value
 /constant
 /global

 !-- = Default Formset
 = --
 formset
 form  name=sForm
 field  property=name  depends=required
 arg0  key=test.name/
 /field

 /form
 /formset
 /form-validation


I write the struts-config.xml as following for mapping

  action
   attribute=sForm
   input=/form/s.jsp
   name=sForm
   path=/s
   scope=request
   type=com.eam.struts.action.SAction
   validate=true
   forward name=success path=/welcome.do /
 /action



The form extends the ValidatorForm,

But it does NOT work.

Who can  help me?


Thanks a lot.

-- 
Why Signature?
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Information transmitted by this EMAIL is proprietary to iGATE Group of 
Companies and is intended for use only by the individual 
or entity to whom it is addressed and may contain information that is 
privileged, confidential, or exempt from disclosure under 
applicable law. If you are not the intended recipient of this EMAIL immediately 
notify the sender at iGATE or [EMAIL PROTECTED] 
and delete this EMAIL including any attachments
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


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



Re: Help:validation is not working with struts1.2

2006-05-30 Thread Dave Newton
The Jasper wrote:
 Also, you might want to extend ValidatorActionForm instead of
 ValidatorForm, but to tell the truth I'm not sure I really understand
 the difference.

For future reference and completeness:

You can specify validations based on either the form bean name or the
action mapping path.

ValidatorActionForm looks for validations based on the action path. This
allows re-use of a form bean with potentially different validaton. One
possible use is a wizard that uses one form bean to capture all
information but does so across multiple web pages. If your validation is
based on the action path you can validate only portions of the form bean
for each page.

ValidatorForm looks for validations based on the form bean name, meaning
that you may only have one set of validations for that bean.

FWIW I almost always use ValidatorActionForm (well,
DynaValidatorActionForm) so I can reuse beans at will; if there's any
advantage to using ValidatorForm I'm not sure what it is. (That's an
implied question; are there any reasons?)

Dave



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



Help:validation is not working with struts1.2

2006-05-29 Thread M.Liang Liu

I tried to use validator in my struts application and I find a problem
occurred:
The form did not validate itself and the execute method is
always called.

I active the plug-in in struts-config.xml as following:


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


and I write the validation.xml as following:


?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
global
constant
constant-namephone/constant-name
constant-value^\(?(\d{3})\)?[-| ]?(\d{3})[-|
]?(\d{4})$/constant-value
/constant
constant
constant-namezip/constant-name
constant-value^\d{5}\d*$/constant-value
/constant
/global

!-- = Default Formset
= --
formset
form  name=sForm
field  property=name  depends=required
arg0  key=test.name/
/field

/form
/formset
/form-validation



I write the struts-config.xml as following for mapping


 action
  attribute=sForm
  input=/form/s.jsp
  name=sForm
  path=/s
  scope=request
  type=com.eam.struts.action.SAction
  validate=true
  forward name=success path=/welcome.do /
/action




The form extends the ValidatorForm,

But it does NOT work.

Who can  help me?


Thanks a lot.

--
Why Signature?