Re: Struts validator, validating dates with pattern.

2003-06-18 Thread Eirik Kjølsrud
Hi Nagendra, and thanks for your suggestion !

That "kinda" worked... 
Using 
 datePatternStrict
dd.MM.
  

resulted in the datefield being correctly validated to the dd.MM. format, but I 
would also like it to allow both these formats of date : 
08.11.1976 and 8.11.1976. I believe that the use of datePatternStrict force the use of 
leading zeros ?

How come when I use only datePattern instead of datePatternStrict, nothing is 
validated ?

Best Regards
Eirik Kjølsrud

  -- original message -
  > hi,
  >  use this syntax
  >
  >  datePatternStrict
  >  dd/MM/
  >  

 


Struts validator, validating dates with pattern.

2003-06-18 Thread Eirik Kjølsrud
Hi.

I'm using Struts 1.1 RC1 and wants to validate a date in an input field as
required and date. The part in validation.xml describing the validation is :




datePattern
dd.MM.

 

The required field triggers, but regardless of value in the date field, the
date validation does not trigger an error message. In the application
resources file, the errors.date field is populated.

Any help is greatly appreciated !

Best Regards
Eirik Kjølsrud, Norway




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



Errorhandling - ServletException

2003-06-13 Thread Eirik Kjølsrud
Hi.

I've set up a custom errorhandler in Struts that catches every exception
that occurs in the Actions, and presents an errorpage. This works perfectly.

The jsp-pages that represents the 'view' sometimes throws an exception, and
I have set up an errorhandler in the web.xml file to handle that. Actually
this errorhandler forwards to an action which throws an exception that is
caught by the beforementioned custom errorhandler and is therefore handled
and logged the same way. Unfortunately the errorhandler specified in web.xml
does not trigger on servletexceptions. I have tried it with http-errorcodes
(400, 404, etc.) and then it works, but when an exception is thrown in the
jsps, a message like this is presented on screen :

[ServletException
in:/WEB-INF/protectedJSP/content/content-gameparamEdit.jsp] null'

My set up in web.xml is :



404

/jSPErrorHandler.do





javax.servlet.ServletException

/jSPErrorHandler.do



I haven't added any error-code elements in my jsps. What do I need to
trigger /jSPErrorHandler.do when a ServletException occurs ?

Best Regards
Eirik Kjølsrud, Norway




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



Re: Handling ServletException

2003-06-06 Thread Eirik Kjølsrud
Thanks,

I'll set up an  element. I would like all reported errors to be
caught though, but it seems that the  element requires an
 element as well.

Does this mean that I have to add an  element for every
 I want to catch, or is there a way to tell teh container to
route every error to an error page ?

Best Regards
Eirik

"David Graham" <[EMAIL PROTECTED]> skrev i melding
news:[EMAIL PROTECTED]
> The Struts exception handling mechanism only handles exceptions thrown
from
> Action.execute() methods.  Your JSP is probably throwing an exception so
you
> need to setup  elements in web.xml to point to a friendlier
> error page.
>
> David
>
>
> >Hi.
> >
> >I've followed "everyone"s advice and written a custom Exception handler.
> >The
> >exceptionhandler is set up in struts-config to catch all exceptions :
> >
> >
> >
> >
> >
> > >
> >handler="mypackage.strutsextensions.CustomizedExceptionHandler"
> >
> >key="global.error.message"
> >
> >scope="request"
> >
> >type="java.lang.Exception"/>
> >
> >
> >
> >This works great, but my problem is that sometimes there occures a
> >SerlvetException which is just presented on screen and is not caught by
my
> >CustomizedExceptionHandler. I believe that this is because the
> >ServletException is thrown by the container ?? Anyhow, I would like to
> >catch
> >these exceptions as well, and preferably route them to my custom Error
> >handler.
> >
> >Does anyone have some advice on how to handle ServletExceptions to give
the
> >user better information ?
> >
> >Best Regards
> >
> >Eirik Kjølsrud, Norway
> >
> >
> >
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> _
> Add photos to your e-mail with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail




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



Handling ServletException

2003-06-05 Thread Eirik Kjølsrud
Hi.

I've followed "everyone"s advice and written a custom Exception handler. The
exceptionhandler is set up in struts-config to catch all exceptions :









This works great, but my problem is that sometimes there occures a
SerlvetException which is just presented on screen and is not caught by my
CustomizedExceptionHandler. I believe that this is because the
ServletException is thrown by the container ?? Anyhow, I would like to catch
these exceptions as well, and preferably route them to my custom Error
handler.

Does anyone have some advice on how to handle ServletExceptions to give the
user better information ?

Best Regards

Eirik Kjølsrud, Norway




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



Re: Validation : No client message presented. Please help.

2003-06-04 Thread Eirik Kjølsrud
Hi again.

Krishnakumar N posted a fix for this as a reply to my first post.

> I think this is a bug with the validator-rules.xml that ships
> with rc1. The integer validation javascript may need to be
> changed slightly as follows:
>
>
> ...
> if (!isAllDigits(value)) {
> ++ if (i == 0) {
> ++ focusField = field;
> ++ }
> ++ fields[i++] = oInteger[x][1];
> bValid = false;
> } else {
> var iValue = parseInt(value);
> if (isNaN(iValue) ||
> !(iValue >= -2147483648 && iValue <= 2147483647)) {
> if (i == 0) {
> focusField = field;
> }
> fields[i++] = oInteger[x][1];
>     bValid = false;
>}
> ...


Thanks,
Eirik

"Eirik Kjølsrud" <[EMAIL PROTECTED]> skrev i melding
news:[EMAIL PROTECTED]
> Hi.
>
> I still haven't been able to solve the problem from my post yesterday,
which
> basically is that if I use 'required' validation, a javascript alert
informs
> the user on the client side if a field is not filled in, it works
perfectly.
> However, if I try to use 'integer' validation the alert message does not
> present itself. The field is validated though, I'm not allowed to submit
the
> form before the fields have integer values, but no message is presented.
The
> errors.integer message is set up in ApplicationResources.properties.
>
> Any thoughts on why this is not working ?
>
> Best Regards
> Eirik Kjølsrud, Norway




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



Re: Validation : Can't validate integer fields...

2003-06-04 Thread Eirik Kjølsrud
Hi Krishna,

and thank you very much for your help : )

I just added the lines you specified, and now it works perfectly !!

Thanks,
Eirik

"Krishnakumar N" <[EMAIL PROTECTED]> skrev i melding
news:[EMAIL PROTECTED]
> Resending as previous mail seems to have got lost.
>
> Cheers,
> Krishna
>
> > -Original Message-
> > From: Krishnakumar N
> > Sent: Wednesday, June 04, 2003 2:04 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: Validation : Can't validate integer fields...
> >
> >
> > I think this is a bug with the validator-rules.xml that ships
> > with rc1. The integer validation javascript may need to be
> > changed slightly as follows:
> >
> >
> > ...
> > if (!isAllDigits(value)) {
> > ++ if (i == 0) {
> > ++ focusField = field;
> > ++ }
> > ++ fields[i++] = oInteger[x][1];
> > bValid = false;
> > } else {
> > var iValue = parseInt(value);
> > if (isNaN(iValue) ||
> > !(iValue >= -2147483648 && iValue <= 2147483647)) {
> > if (i == 0) {
> > focusField = field;
> > }
> > fields[i++] = oInteger[x][1];
> >     bValid = false;
> >}
> > ...
> >
> >  I do not know if this has been fixed in the latest cvs versions.
> >
> > Cheers,
> > Krishna
> >
> > > -Original Message-
> > > From: Eirik Kjølsrud [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, June 03, 2003 8:30 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Validation : Can't validate integer fields...
> > >
> > >
> > > Hi,
> > >
> > > I'm new to this group. I'm a java developer working currently
> > > on projects
> > > for the Norwegian National Lottery.
> > >
> > > In an input form, I'm trying to validate user input on the
> > > client, making
> > > sure that the values are integers. My problem is that no message is
> > > presented for "errors.integer", only for "errors.required". I
> > > have tried to
> > > list out some information in the javascript for integer
> > validation in
> > > 'validation-rules.xml', and the field is validated correctly.
> > > I also cannot
> > > submit the form unless all values are integers, but there is
> > > no messagebox
> > > telling the user what is wrong as it is when the field is empty.
> > >
> > > Any help would be appreciated : )
> > >
> > > Best Regards
> > > Eirik Kjølsrud, Norway
> > >
> > > Here are some details :
> > >
> > > I am using a DynaValidatorForm :
> > >  > > type="org.apache.struts.validator.DynaValidatorForm">
> > >
> > > 
> > >
> > > 
> > >
> > > 
> > >
> > > 
> > >
> > > 
> > >
> > > 
> > >
> > > 
> > >
> > > 
> > >
> > > The part for the formset in the validation.xml file :
> > >
> > > 
> > >
> > > 
> > >
> > >  > >
> > > depends="required,integer">
> > >
> > > 
> > >
> > > 
> > >
> > >  > >
> > > depends="required,integer">
> > >
> > > 
> > >
> > > 
> > >
> > >  > >
> > > depends="required,integer">
> > >
> > > 
> > >
> > > 
> > >
> > >  > >
> > > depends="required,integer">
> > >
> > > 
> > >
> > > 
> > >
> > >  > >
> > > depends="required,integer">
> > >
> > > 
> > >
> > > 
> > >
> > >  > >
> > > depends="required,integer">
> > >
> > > 
> > >
> > > 
> > >
> > > 
> > >
> > > 
> > >
> > > And finally the ApplicationResources where the messages are
> > stored. As
> > > mentioned, the required message is presented, but not the integer :
> > >
> > > # Validator errormessages
> > >
> > > errors.required={0} må fylles ut.
> > >
> > > errors.integer={0} må være et heltall.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > -
> > > 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]



Validation : No client message presented. Please help.

2003-06-04 Thread Eirik Kjølsrud
Hi.

I still haven't been able to solve the problem from my post yesterday, which
basically is that if I use 'required' validation, a javascript alert informs
the user on the client side if a field is not filled in, it works perfectly.
However, if I try to use 'integer' validation the alert message does not
present itself. The field is validated though, I'm not allowed to submit the
form before the fields have integer values, but no message is presented. The
errors.integer message is set up in ApplicationResources.properties.

Any thoughts on why this is not working ?

Best Regards
Eirik Kjølsrud, Norway




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



Validation : Can't validate integer fields...

2003-06-04 Thread Eirik Kjølsrud
Hi,

I'm new to this group. I'm a java developer working currently on projects
for the Norwegian National Lottery.

In an input form, I'm trying to validate user input on the client, making
sure that the values are integers. My problem is that no message is
presented for "errors.integer", only for "errors.required". I have tried to
list out some information in the javascript for integer validation in
'validation-rules.xml', and the field is validated correctly. I also cannot
submit the form unless all values are integers, but there is no messagebox
telling the user what is wrong as it is when the field is empty.

Any help would be appreciated : )

Best Regards
Eirik Kjølsrud, Norway

Here are some details :

I am using a DynaValidatorForm :


















The part for the formset in the validation.xml file :













































And finally the ApplicationResources where the messages are stored. As
mentioned, the required message is presented, but not the integer :

# Validator errormessages

errors.required={0} må fylles ut.

errors.integer={0} må være et heltall.








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