You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David White <wh...@home.com> on 2001/07/10 21:33:23 UTC

Any Success With Validator?

I have a small and simple web app that I have working with vanilla
struts. I am trying to incorporate the struts validator mechanism by
converting just one form. To do so, I have done the following:

	Placed the Struts_Validator-20010702.jar into the web app's lib dir.

        Place the jakarta-regexp-1.2.jar into the web app's lib dir.

        Place the struts-validator.tld into the web app's WEB-INF dir
(along with the struts tag lib files).

        Copy the example validation.xml file into the web app's WEB-INF
dir. Removed all but one form from the default (no locale) formset.
Edited each field so that it depends on "require" only. Removed all the
localized formsets.

        Cut & paste from the validator servlet definition from the
example web.xml into mine. Changed the taglib reference for the
validator taglib (no tld durectory).

        Changed the jsp to use the validator:errorsExist tag in place of
the struts errors tag. Added the validator tag lib to the page.

        Changed the form class so that it extends ValidatorForm rather
than struts ActionForm. Commented out my previously coded validate()
method in the form class.

        In the form's action class, remove the check for errors in the
perform() method.

	Added validate="true" to the form's action in the struts-config.xml
file.

When I submit the page with empty fields, no errors are reported and the
form's action just marches merrily along forwarding to the next jsp
which fails because parameters are empty. I have looked and tried again
and again with no luck. Before I give up, I thought I'd ask for help
here. Any ideas as to what I am missing?

Thanks In Advance,

David
Seattle

logic:iterator indexId?

Posted by "Mimpin Halim [Lucas]" <lu...@rainbows.net>.
Hi Everyone,

Anybody knows how to use the indexId in the logic:iterator tag?
Will it give us indexed html form element?

Please hellpppp...

Thanks,

Lucas


Re: Any Success With Validator?

Posted by David Winterfeldt <dw...@yahoo.com>.
Standard out goes to the console window not to the log
file.  If you are starting Tomcat as a background
process, don't.  Then as it starts you will see some
Struts and Validator print out.

David

--- David White <wh...@home.com> wrote:
> My web app is called my-struts-example. The servlet
> log from Tomcat
> follows. My debug for both struts and validator
> servelts is 1 or higher.
> I do not see what you are talking about, David.
> Thanks for the help.
> 
> <<< servlet.log >>>
> 2001-07-10 03:47:30 - path="/examples" :jsp: init
> 2001-07-10 03:47:30 - path="/doc" :jsp: init
> 2001-07-10 03:47:30 - path="/InstallRoot" :jsp: init
> 2001-07-10 03:47:30 - path="/admin" :jsp: init
> 2001-07-10 03:47:30 - path="/struts-example" :jsp:
> init
> 2001-07-10 03:47:30 - path="/struts-example"
> :database: init
> 2001-07-10 03:47:30 - path="/struts-example"
> :database: Initializing
> database servlet
> 2001-07-10 03:47:30 - path="/struts-example"
> :database: Loading database
> from '/WEB-INF/database.xml'
> 2001-07-10 03:47:31 - path="/struts-example"
> :action: init
> 2001-07-10 03:47:31 - path="/struts-example"
> :action: Loading
> application resources from resource
>
org.apache.struts.webapp.example.ApplicationResources
> 2001-07-10 03:47:31 - path="/struts-example"
> :action: Initializing
> configuration from resource path
> /WEB-INF/struts-config.xml
> 2001-07-10 03:47:31 - path="/struts-example"
> :action: Process
> servletName=action, urlPattern=*.do
> 2001-07-10 03:47:31 - path="/struts-example"
> :action: Mapping for
> servlet 'action' = '*.do'
> 2001-07-10 03:47:31 - path="/validator" :jsp: init
> 2001-07-10 03:47:31 - path="/my-struts-example"
> :jsp: init
> 2001-07-10 03:47:31 - path="/my-struts-example"
> :validator: init
> 2001-07-10 03:47:31 - path="/my-struts-example"
> :validator: Loading
> validation file from '/WEB-INF/validation.xml'
> 2001-07-10 03:47:32 - path="/my-struts-example"
> :action: init
> 2001-07-10 03:47:32 - path="/my-struts-example"
> :action: Loading
> application resources from resource
> ApplicationResources
> 2001-07-10 03:47:32 - path="/my-struts-example"
> :action: Initializing
> configuration from resource path
> /WEB-INF/struts-config.xml
> 2001-07-10 03:47:33 - path="/my-struts-example"
> :action: Process
> servletName=action, urlPattern=*.do
> 2001-07-10 03:47:33 - path="/my-struts-example"
> :action: Mapping for
> servlet 'action' = '*.do'
> 2001-07-10 03:47:33 - path="" :jsp: init
> 2001-07-10 03:47:33 - path="/webcontainer_examples"
> :jsp: init
> 2001-07-10 03:50:47 - path="/my-struts-example"
> :jsp: init
> 2001-07-10 03:51:19 - path="/my-struts-example"
> :jsp: init
> 2001-07-10 03:51:22 - path="/my-struts-example"
> :action: Processing a
> POST for /logon
> 2001-07-10 03:51:22 - path="/my-struts-example"
> :action: Setting locale
> 'en'
> 2001-07-10 03:51:22 - path="/my-struts-example"
> :action:  Looking for
> ActionForm bean under attribute 'logonForm'
> 2001-07-10 03:51:22 - path="/my-struts-example"
> :action:  Creating new
> ActionForm instance of class 'LogonForm'
> 2001-07-10 03:51:22 - path="/my-struts-example"
> :action:  Storing
> instance under attribute 'logonForm' in scope
> 'request'
> 2001-07-10 03:51:22 - path="/my-struts-example"
> :action:  Populating
> bean properties from this request
> 2001-07-10 03:51:22 - path="/my-struts-example"
> :action:  Validating
> input form properties
> 2001-07-10 03:51:22 - path="/my-struts-example"
> :action:   No errors
> detected, accepting input
> 2001-07-10 03:51:22 - path="/my-struts-example"
> :action:  Looking for
> Action instance for class LogonAction
> 2001-07-10 03:51:22 - path="/my-struts-example"
> :action:   Double
> checking for Action instance already there
> 2001-07-10 03:51:22 - path="/my-struts-example"
> :action:   Creating new
> Action instance
> 2001-07-10 03:51:25 - path="/my-struts-example"
> :jsp: init
> <<< servlet.log >>>
> 
> David Winterfeldt wrote:
> > 
> > If the debug is greater than zero when you are
> > initializing the ValidatorServlet, you should see
> the
> > the form values being printed to standard out. 
> Can
> > you see anything?  This is a good check as to
> whether
> > the resource is loading.  Do you have the error
> > messages defined in your messages resources?  The
> > default one for required is 'errors.required'.
> > 
> > David
> > 
> > --- David White <wh...@home.com> wrote:
> > > I have a small and simple web app that I have
> > > working with vanilla
> > > struts. I am trying to incorporate the struts
> > > validator mechanism by
> > > converting just one form. To do so, I have done
> the
> > > following:
> > >
> > >       Placed the Struts_Validator-20010702.jar
> into the
> > > web app's lib dir.
> > >
> > >         Place the jakarta-regexp-1.2.jar into
> the
> > > web app's lib dir.
> > >
> > >         Place the struts-validator.tld into the
> web
> > > app's WEB-INF dir
> > > (along with the struts tag lib files).
> > >
> > >         Copy the example validation.xml file
> into
> > > the web app's WEB-INF
> > > dir. Removed all but one form from the default
> (no
> > > locale) formset.
> > > Edited each field so that it depends on
> "require"
> > > only. Removed all the
> > > localized formsets.
> > >
> > >         Cut & paste from the validator servlet
> > > definition from the
> > > example web.xml into mine. Changed the taglib
> > > reference for the
> > > validator taglib (no tld durectory).
> > >
> > >         Changed the jsp to use the
> > > validator:errorsExist tag in place of
> > > the struts errors tag. Added the validator tag
> lib
> > > to the page.
> > >
> > >         Changed the form class so that it
> extends
> > > ValidatorForm rather
> > > than struts ActionForm. Commented out my
> previously
> > > coded validate()
> > > method in the form class.
> > >
> > >         In the form's action class, remove the
> check
> > > for errors in the
> > > perform() method.
> > >
> > >       Added validate="true" to the form's action
> in the
> > > struts-config.xml
> > > file.
> > >
> > > When I submit the page with empty fields, no
> errors
> > > are reported and the
> > > form's action just marches merrily along
> forwarding
> > > to the next jsp
> > > which fails because parameters are empty. I have
> > > looked and tried again
> > > and again with no luck. Before I give up, I
> thought
> > > I'd ask for help
> > > here. Any ideas as to what I am missing?
> > >
> > > Thanks In Advance,
> > >
> > > David
> 
=== message truncated ===


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

Re: Any Success With Validator?

Posted by David White <wh...@home.com>.
My web app is called my-struts-example. The servlet log from Tomcat
follows. My debug for both struts and validator servelts is 1 or higher.
I do not see what you are talking about, David. Thanks for the help.

<<< servlet.log >>>
2001-07-10 03:47:30 - path="/examples" :jsp: init
2001-07-10 03:47:30 - path="/doc" :jsp: init
2001-07-10 03:47:30 - path="/InstallRoot" :jsp: init
2001-07-10 03:47:30 - path="/admin" :jsp: init
2001-07-10 03:47:30 - path="/struts-example" :jsp: init
2001-07-10 03:47:30 - path="/struts-example" :database: init
2001-07-10 03:47:30 - path="/struts-example" :database: Initializing
database servlet
2001-07-10 03:47:30 - path="/struts-example" :database: Loading database
from '/WEB-INF/database.xml'
2001-07-10 03:47:31 - path="/struts-example" :action: init
2001-07-10 03:47:31 - path="/struts-example" :action: Loading
application resources from resource
org.apache.struts.webapp.example.ApplicationResources
2001-07-10 03:47:31 - path="/struts-example" :action: Initializing
configuration from resource path /WEB-INF/struts-config.xml
2001-07-10 03:47:31 - path="/struts-example" :action: Process
servletName=action, urlPattern=*.do
2001-07-10 03:47:31 - path="/struts-example" :action: Mapping for
servlet 'action' = '*.do'
2001-07-10 03:47:31 - path="/validator" :jsp: init
2001-07-10 03:47:31 - path="/my-struts-example" :jsp: init
2001-07-10 03:47:31 - path="/my-struts-example" :validator: init
2001-07-10 03:47:31 - path="/my-struts-example" :validator: Loading
validation file from '/WEB-INF/validation.xml'
2001-07-10 03:47:32 - path="/my-struts-example" :action: init
2001-07-10 03:47:32 - path="/my-struts-example" :action: Loading
application resources from resource ApplicationResources
2001-07-10 03:47:32 - path="/my-struts-example" :action: Initializing
configuration from resource path /WEB-INF/struts-config.xml
2001-07-10 03:47:33 - path="/my-struts-example" :action: Process
servletName=action, urlPattern=*.do
2001-07-10 03:47:33 - path="/my-struts-example" :action: Mapping for
servlet 'action' = '*.do'
2001-07-10 03:47:33 - path="" :jsp: init
2001-07-10 03:47:33 - path="/webcontainer_examples" :jsp: init
2001-07-10 03:50:47 - path="/my-struts-example" :jsp: init
2001-07-10 03:51:19 - path="/my-struts-example" :jsp: init
2001-07-10 03:51:22 - path="/my-struts-example" :action: Processing a
POST for /logon
2001-07-10 03:51:22 - path="/my-struts-example" :action: Setting locale
'en'
2001-07-10 03:51:22 - path="/my-struts-example" :action:  Looking for
ActionForm bean under attribute 'logonForm'
2001-07-10 03:51:22 - path="/my-struts-example" :action:  Creating new
ActionForm instance of class 'LogonForm'
2001-07-10 03:51:22 - path="/my-struts-example" :action:  Storing
instance under attribute 'logonForm' in scope 'request'
2001-07-10 03:51:22 - path="/my-struts-example" :action:  Populating
bean properties from this request
2001-07-10 03:51:22 - path="/my-struts-example" :action:  Validating
input form properties
2001-07-10 03:51:22 - path="/my-struts-example" :action:   No errors
detected, accepting input
2001-07-10 03:51:22 - path="/my-struts-example" :action:  Looking for
Action instance for class LogonAction
2001-07-10 03:51:22 - path="/my-struts-example" :action:   Double
checking for Action instance already there
2001-07-10 03:51:22 - path="/my-struts-example" :action:   Creating new
Action instance
2001-07-10 03:51:25 - path="/my-struts-example" :jsp: init
<<< servlet.log >>>

David Winterfeldt wrote:
> 
> If the debug is greater than zero when you are
> initializing the ValidatorServlet, you should see the
> the form values being printed to standard out.  Can
> you see anything?  This is a good check as to whether
> the resource is loading.  Do you have the error
> messages defined in your messages resources?  The
> default one for required is 'errors.required'.
> 
> David
> 
> --- David White <wh...@home.com> wrote:
> > I have a small and simple web app that I have
> > working with vanilla
> > struts. I am trying to incorporate the struts
> > validator mechanism by
> > converting just one form. To do so, I have done the
> > following:
> >
> >       Placed the Struts_Validator-20010702.jar into the
> > web app's lib dir.
> >
> >         Place the jakarta-regexp-1.2.jar into the
> > web app's lib dir.
> >
> >         Place the struts-validator.tld into the web
> > app's WEB-INF dir
> > (along with the struts tag lib files).
> >
> >         Copy the example validation.xml file into
> > the web app's WEB-INF
> > dir. Removed all but one form from the default (no
> > locale) formset.
> > Edited each field so that it depends on "require"
> > only. Removed all the
> > localized formsets.
> >
> >         Cut & paste from the validator servlet
> > definition from the
> > example web.xml into mine. Changed the taglib
> > reference for the
> > validator taglib (no tld durectory).
> >
> >         Changed the jsp to use the
> > validator:errorsExist tag in place of
> > the struts errors tag. Added the validator tag lib
> > to the page.
> >
> >         Changed the form class so that it extends
> > ValidatorForm rather
> > than struts ActionForm. Commented out my previously
> > coded validate()
> > method in the form class.
> >
> >         In the form's action class, remove the check
> > for errors in the
> > perform() method.
> >
> >       Added validate="true" to the form's action in the
> > struts-config.xml
> > file.
> >
> > When I submit the page with empty fields, no errors
> > are reported and the
> > form's action just marches merrily along forwarding
> > to the next jsp
> > which fails because parameters are empty. I have
> > looked and tried again
> > and again with no luck. Before I give up, I thought
> > I'd ask for help
> > here. Any ideas as to what I am missing?
> >
> > Thanks In Advance,
> >
> > David
> > Seattle
> 
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/

Re: Any Success With Validator?

Posted by David Winterfeldt <dw...@yahoo.com>.
If the debug is greater than zero when you are
initializing the ValidatorServlet, you should see the
the form values being printed to standard out.  Can
you see anything?  This is a good check as to whether
the resource is loading.  Do you have the error
messages defined in your messages resources?  The
default one for required is 'errors.required'.

David

--- David White <wh...@home.com> wrote:
> I have a small and simple web app that I have
> working with vanilla
> struts. I am trying to incorporate the struts
> validator mechanism by
> converting just one form. To do so, I have done the
> following:
> 
> 	Placed the Struts_Validator-20010702.jar into the
> web app's lib dir.
> 
>         Place the jakarta-regexp-1.2.jar into the
> web app's lib dir.
> 
>         Place the struts-validator.tld into the web
> app's WEB-INF dir
> (along with the struts tag lib files).
> 
>         Copy the example validation.xml file into
> the web app's WEB-INF
> dir. Removed all but one form from the default (no
> locale) formset.
> Edited each field so that it depends on "require"
> only. Removed all the
> localized formsets.
> 
>         Cut & paste from the validator servlet
> definition from the
> example web.xml into mine. Changed the taglib
> reference for the
> validator taglib (no tld durectory).
> 
>         Changed the jsp to use the
> validator:errorsExist tag in place of
> the struts errors tag. Added the validator tag lib
> to the page.
> 
>         Changed the form class so that it extends
> ValidatorForm rather
> than struts ActionForm. Commented out my previously
> coded validate()
> method in the form class.
> 
>         In the form's action class, remove the check
> for errors in the
> perform() method.
> 
> 	Added validate="true" to the form's action in the
> struts-config.xml
> file.
> 
> When I submit the page with empty fields, no errors
> are reported and the
> form's action just marches merrily along forwarding
> to the next jsp
> which fails because parameters are empty. I have
> looked and tried again
> and again with no luck. Before I give up, I thought
> I'd ask for help
> here. Any ideas as to what I am missing?
> 
> Thanks In Advance,
> 
> David
> Seattle


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