Re: validation question

2010-01-08 Thread Gabriel Belingueres
As a starting point you may check the freemarker .ftl files from the
XHTML template.

2010/1/8 Robby Atchison :
> Hello,  I would like to know how an actionname-validation.xml is tied to the
> client-side validation.  I figure somewhere the xml file is read and
> Javascript is output.  I'm having trouble connecting the dots.  Any
> information and help will be appreciated.
>
>
>
> Best regards!
>
>
>
> Robby
>
> rob...@msn.com
>
>
>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Validation question

2008-01-11 Thread Martin Braure de Calignon

Le vendredi 11 janvier 2008 à 15:46 -0800, Dave Newton a écrit :
> The validation interceptor will look for, and call, validate${methodName}
> (and validateDo${methodName}).
> 
> d.

Great ! thank you all :-)
-- 
Martin Braure de Calignon


signature.asc
Description: Ceci est une partie de message	numériquement signée


Re: Validation question

2008-01-11 Thread Dave Newton
The validation interceptor will look for, and call, validate${methodName}
(and validateDo${methodName}).

d.

--- Martin Braure de Calignon <[EMAIL PROTECTED]> wrote:

> 
> Le vendredi 11 janvier 2008 à 09:15 -0500, Ted Husted a écrit :
> > On Jan 11, 2008 8:10 AM, Martin Braure de Calignon <[EMAIL PROTECTED]>
> wrote:
> > > Of course yes :-). But I need a validate() per method.
> > 
> > I haven't used it myself, but the syntax validate-action is suppose to
> > work, in the same way that it works for the validation framework.
> 
> I don't think so. You see, with per alias or per method validation, you
> can have multiple xml files for the same action with the filename
> format : ActionName-alias-validation.xml
> 
> e.g.: 
> if I have defined my action like this :
> 
> View1.jsp
> View2.jsp
> View3.jsp
> 
> 
> I can per alias validation. As I'm using wildcards, it is as if I
> defined CycleManagement!A action and CycleManagement!B action ...
> 
> So I can have :
> CycleManagement-CycleManagement!A-validation.xml
> CycleManagement-CycleManagement!B-validation.xml
> CycleManagement-CycleManagement!C-validation.xml
> 
> I don't see how implementing Validatable allow me such a thing. I will
> only have one Validate() method (without parameter) for my action class.
> 
> No ? Am I missing something ?
> 
> Cheers,
> 
> -- 
> Martin Braure de Calignon
> 


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



Re: Validation question

2008-01-11 Thread Martin Braure de Calignon

Le vendredi 11 janvier 2008 à 09:15 -0500, Ted Husted a écrit :
> On Jan 11, 2008 8:10 AM, Martin Braure de Calignon <[EMAIL PROTECTED]> wrote:
> > Of course yes :-). But I need a validate() per method.
> 
> I haven't used it myself, but the syntax validate-action is suppose to
> work, in the same way that it works for the validation framework.

I don't think so. You see, with per alias or per method validation, you
can have multiple xml files for the same action with the filename
format : ActionName-alias-validation.xml

e.g.: 
if I have defined my action like this :

View1.jsp
View2.jsp
View3.jsp


I can per alias validation. As I'm using wildcards, it is as if I
defined CycleManagement!A action and CycleManagement!B action ...

So I can have :
CycleManagement-CycleManagement!A-validation.xml
CycleManagement-CycleManagement!B-validation.xml
CycleManagement-CycleManagement!C-validation.xml

I don't see how implementing Validatable allow me such a thing. I will
only have one Validate() method (without parameter) for my action class.

No ? Am I missing something ?

Cheers,

-- 
Martin Braure de Calignon


signature.asc
Description: Ceci est une partie de message	numériquement signée


Re: Validation question

2008-01-11 Thread Ted Husted
On Jan 11, 2008 8:10 AM, Martin Braure de Calignon <[EMAIL PROTECTED]> wrote:
> Of course yes :-). But I need a validate() per method.

I haven't used it myself, but the syntax validate-action is suppose to
work, in the same way that it works for the validation framework.

HTH, Ted
 * 

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



Re: Validation question

2008-01-11 Thread Martin Braure de Calignon

Le vendredi 11 janvier 2008 à 07:36 -0500, Ted Husted a écrit :
> Rather than use the validation framework, I'd probably go with a
> Validate method (by implementing Validatable).

Firstly, thank you very much for your answer :)

Ok then... That what I though... But my problem is that Validate() is
called every time no ?
I mean, I currently use action like that :


View1.jsp
View2.jsp
View3.jsp


and I have per-method validation...
Is it possible with Validate() ? How can I do ? (I think it's possible
with ActionContext.(... get current method...))

> Then, instead of using an OGNL expression, you can loop through the
> list using Java, and call addFieldError if there's a problem.
Of course yes :-). But I need a validate() per method.

> Alternatively, a custom type converter that turned the nulls into
> false booleans might work, or there might be another way to form the
> OGNL expression. But given the choice between OGNL and Java, I'll take
> Java. :)

So for me it seems the better choice would be type converter ? what do
you think ?

Thanks,

-- 
Martin Braure de Calignon


signature.asc
Description: Ceci est une partie de message	numériquement signée


Re: Validation question

2008-01-11 Thread Ted Husted
Rather than use the validation framework, I'd probably go with a
Validate method (by implementing Validatable).

Then, instead of using an OGNL expression, you can loop through the
list using Java, and call addFieldError if there's a problem.

Alternatively, a custom type converter that turned the nulls into
false booleans might work, or there might be another way to form the
OGNL expression. But given the choice between OGNL and Java, I'll take
Java. :)

HTH, Ted


On Jan 8, 2008 8:08 AM, Martin Braure de Calignon <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'm currently using struts2 for a project.
> I want to validate all elements of a list (each elements should have a
> non-empty value, or the list should be empty).
>
> what I have done in my validator is :
> 
>
> 
> 
> 
> 
> error ${myList.size}
> 
> 
>
> Then in console I have a warning, and the validator does not do what I
> want.
> WARN - Got result of null when trying to get Boolean
> I don't know if it is related to my validator but it seems to be.
>
> Any idea on how writing validator on all elements of the list ?
>
> Thanks :-)
> --
> Martin Braure de Calignon

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



Re: Validation Question how to echo back users input in error message?

2005-11-08 Thread Niall Pemberton
Not from the request - from the form bean (or indexed Bean) - in this
example lineNumber needs to be a property of the indexed bean.

Niall

- Original Message - 
From: "Michael Jouravlev" <[EMAIL PROTECTED]>
Sent: Wednesday, November 09, 2005 12:47 AM


On 11/8/05, Niall Pemberton <[EMAIL PROTECTED]> wrote:
> The short answer is that there isn't a way to echo back user input in the
> error message.
...
> There are two places that I know of, where this kind of functionality has
> been provided. The first is in the "extends validator" I wrote (see the
> "indexed example"):
>
>http://www.niallp.pwp.blueyonder.co.uk/strutsvalidatorextends.html


  
extendsItems
  
  


Are you saying that it will take a real lineNumber from request? How
does it know to get if from request? Does it just checks if request
has this key, and if not, goes to the property file?

Michael.

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





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



Re: Validation Question how to echo back users input in error message?

2005-11-08 Thread Michael Jouravlev
On 11/8/05, Niall Pemberton <[EMAIL PROTECTED]> wrote:
> The short answer is that there isn't a way to echo back user input in the
> error message.
...
> There are two places that I know of, where this kind of functionality has
> been provided. The first is in the "extends validator" I wrote (see the
> "indexed example"):
>
>http://www.niallp.pwp.blueyonder.co.uk/strutsvalidatorextends.html


  
extendsItems
  
  


Are you saying that it will take a real lineNumber from request? How
does it know to get if from request? Does it just checks if request
has this key, and if not, goes to the property file?

Michael.

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



Re: Validation Question how to echo back users input in error message?

2005-11-08 Thread Niall Pemberton
The short answer is that there isn't a way to echo back user input in the
error message. Most of the time I don't think its necessary to do so
anyway - since if you're re-displaying/highlighting errors then what is the
need. The one time I scenario I wanted to do something like that, was when I
had a list, say for example you are displaying a list of orders and you want
a message along the lines "Order date for order number 1234 is invalid" -
where the order number "1234" is a value from the list.

There are two places that I know of, where this kind of functionality has
been provided. The first is in the "extends validator" I wrote (see the
"indexed example"):

   http://www.niallp.pwp.blueyonder.co.uk/strutsvalidatorextends.html

...and the other place was in the javascript validator extension I started
work on:

   http://www.niallp.pwp.blueyonder.co.uk/validatorjs.html

Hopefully, one day I will find some time to work on validator to make these
kind of features standard - but for now theres nothing "out of the box" to
meet this requirement.

Niall

- Original Message - 
From: "Michael Jouravlev" <[EMAIL PROTECTED]>
Sent: Friday, November 04, 2005 6:01 PM


I would like to know the answer on this too. I searched the Net, all
examples use properties from property file. Using resource="false"
does not help with either (neither?) of these variants:






where registrationForm is action form definition in struts-config.xml,
nestedUser is a nested BO. Originating mail address is rendered in
HTML and submitted back to application as "nestedUser.fromAddress".

Commons Validator does not process HttpServletRequest (that is
expected). I glanced at ValidatorForm from Struts Validator
integration, and saw this validate() method:

public ActionErrors validate(ActionMapping mapping,
 HttpServletRequest request) {

  ServletContext application = getServlet().getServletContext();
  ActionErrors errors = new ActionErrors();

  String validationKey = getValidationKey(mapping, request);

  Validator validator = Resources.initValidator(validationKey,
this, application, request, errors, page);

  try {
validatorResults = validator.validate();
  } catch (ValidatorException e) {
log.error(e.getMessage(), e);
  }

  return errors;
}

So, maybe you want to debug this one.

Commons Validator basically does not have documentation, only
Javadocs, which is not very descriptive. No comments in the source,
either. This is frustrating.

Michael.

On 11/4/05, Troy Bull <[EMAIL PROTECTED]> wrote:
> I am using the struts validator and it works almost exactly the way I
want.
>
>
> Say I have a field tf and the value is "ABC"
>
> I want to do a validation requiring it to be an integer and return the
> following error message: "tf must be an integer".
>
> I can do all this pretty easily here is the code that does it:
>
> in ApplicationResources.properties :
>
> validation.error.acty.integer={0} must be an integer and "{1}" is not.
>
> in validations.xml
>
>   
> 
> 
> 
>   
>
>
> my question is what do I put in ?? to get hte actual value the user
> entered to be echoed back out
>
> so if I type in AAA into the acty field I want the error message to be:
>
> ACTY must be an integer and "AAA" is not.
>
> Thanks Troy



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



Re: Validation Question how to echo back users input in error message?

2005-11-04 Thread Michael Jouravlev
I would like to know the answer on this too. I searched the Net, all
examples use properties from property file. Using resource="false"
does not help with either (neither?) of these variants:






where registrationForm is action form definition in struts-config.xml,
nestedUser is a nested BO. Originating mail address is rendered in
HTML and submitted back to application as "nestedUser.fromAddress".

Commons Validator does not process HttpServletRequest (that is
expected). I glanced at ValidatorForm from Struts Validator
integration, and saw this validate() method:

public ActionErrors validate(ActionMapping mapping,
 HttpServletRequest request) {

  ServletContext application = getServlet().getServletContext();
  ActionErrors errors = new ActionErrors();

  String validationKey = getValidationKey(mapping, request);

  Validator validator = Resources.initValidator(validationKey,
this, application, request, errors, page);

  try {
validatorResults = validator.validate();
  } catch (ValidatorException e) {
log.error(e.getMessage(), e);
  }

  return errors;
}

So, maybe you want to debug this one.

Commons Validator basically does not have documentation, only
Javadocs, which is not very descriptive. No comments in the source,
either. This is frustrating.

Michael.

On 11/4/05, Troy Bull <[EMAIL PROTECTED]> wrote:
> I am using the struts validator and it works almost exactly the way I want.
>
>
> Say I have a field tf and the value is "ABC"
>
> I want to do a validation requiring it to be an integer and return the
> following error message: "tf must be an integer".
>
> I can do all this pretty easily here is the code that does it:
>
> in ApplicationResources.properties :
>
> validation.error.acty.integer={0} must be an integer and "{1}" is not.
>
> in validations.xml
>
>   
> 
> 
> 
>   
>
>
> my question is what do I put in ?? to get hte actual value the user
> entered to be echoed back out
>
> so if I type in AAA into the acty field I want the error message to be:
>
> ACTY must be an integer and "AAA" is not.
>
> Thanks Troy

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



Re: validation question...

2005-07-22 Thread Aleksandar Matijaca
I like the CSS 'trick' -- I will try it tonight !

Thanks again Wendy,

Regards, Alex.


On 7/22/05, Wendy Smoak <[EMAIL PROTECTED]> wrote:
> 
> From: "Aleksandar Matijaca" <[EMAIL PROTECTED]>
> > I would like
> > to automatically place a little red * right beside the input field.
> > For my password confirmation field, wnen I put
> > 
> > beside the text field, I get the WHOLE STRING for the 'required'
> > validation,
> > instead, I would like to display only a *.
> 
> The  tag might help...
> http://struts.apache.org/userGuide/struts-logic.html#messagesPresent
> 
> There are also 'errorStyle' and 'errorStyleClass' on the  tags. If
> you can do it in CSS, you can apply it to the form element _only_ when 
> there
> is an error for that property.
> 
> --
> Wendy Smoak
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>


Re: validation question...

2005-07-21 Thread Wendy Smoak

From: "Aleksandar Matijaca" <[EMAIL PROTECTED]>

I would like
to automatically place a little red * right beside the input field.
For my password confirmation field, wnen I put

beside the text field, I get the WHOLE STRING for the 'required' 
validation,

instead, I would like to display only a *.


The  tag might help...
http://struts.apache.org/userGuide/struts-logic.html#messagesPresent

There are also 'errorStyle' and 'errorStyleClass' on the  tags.  If 
you can do it in CSS, you can apply it to the form element _only_ when there 
is an error for that property.


--
Wendy Smoak 




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



Re: validation question...

2005-07-21 Thread Aleksandar Matijaca
It didn't work, but thanks for the effort Laurie...
 Regards, Alex.


 On 7/21/05, Laurie Harper <[EMAIL PROTECTED]> wrote: 
> 
> You could add errorClassId on the input element and use CSS to insert an
> image of a little red *... :-) I can't think of a clean way to find out if
> an error exists for a particular property though. This might work (haven't
> tried it):
> 
> *
> 
> L.
> 
> Aleksandar Matijaca wrote:
> 
> > Hi there,
> > I am currently using the struts validator, and it is working pretty 
> good.
> > My basic error block looks like this:
> >
> >
> > 
> >
> >
> > 
> > 
> >  > />
> > 
> > 
> >
> > 
> >   
> > 
> > 
> > 
> > 
> >
> > 
> >
> > As I said, it loks fairly simple and it works. HOWEVER, I would like
> > to automatically place a little red * right beside the input field.
> > For my password confirmation field, wnen I put
> >
> > 
> >
> > beside the text field, I get the WHOLE STRING for the 'required' 
> validation,
> > instead, I would like to display only a *. I tried
> > *
> > But that does not work, because html:errors tag does not take a body...
> > Any ideas?
> > Thanks, Alex.
> >
> 
> 
> --
> Laurie, Open Source advocate, Java geek and novice blogger:
> http://www.holoweb.net/laurie
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>


Re: validation question...

2005-07-21 Thread Aleksandar Matijaca
Thanks Laurie, I will try it !!
 Cheers, Alex.


 On 7/21/05, Laurie Harper <[EMAIL PROTECTED]> wrote: 
> 
> You could add errorClassId on the input element and use CSS to insert an
> image of a little red *... :-) I can't think of a clean way to find out if
> an error exists for a particular property though. This might work (haven't
> tried it):
> 
> *
> 
> L.
> 
> Aleksandar Matijaca wrote:
> 
> > Hi there,
> > I am currently using the struts validator, and it is working pretty 
> good.
> > My basic error block looks like this:
> >
> >
> > 
> >
> >
> > 
> > 
> >  > />
> > 
> > 
> >
> > 
> >   
> > 
> > 
> > 
> > 
> >
> > 
> >
> > As I said, it loks fairly simple and it works. HOWEVER, I would like
> > to automatically place a little red * right beside the input field.
> > For my password confirmation field, wnen I put
> >
> > 
> >
> > beside the text field, I get the WHOLE STRING for the 'required' 
> validation,
> > instead, I would like to display only a *. I tried
> > *
> > But that does not work, because html:errors tag does not take a body...
> > Any ideas?
> > Thanks, Alex.
> >
> 
> 
> --
> Laurie, Open Source advocate, Java geek and novice blogger:
> http://www.holoweb.net/laurie
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>


Re: validation question...

2005-07-21 Thread Laurie Harper
You could add errorClassId on the input element and use CSS to insert an 
image of a little red *... :-) I can't think of a clean way to find out if 
an error exists for a particular property though. This might work (haven't 
tried it):


  *

L.

Aleksandar Matijaca wrote:


Hi there,
I am currently using the struts validator, and it is working pretty good.
My basic error block looks like this:







/>





  






 
As I said, it loks fairly simple and it works. HOWEVER, I would like

to automatically place a little red * right beside the input field.
For my password confirmation field, wnen I put



beside the text field, I get the WHOLE STRING for the 'required' validation,
instead, I would like to display only a *. I tried
 *
 But that does not work, because html:errors tag does not take a body...
 Any ideas?
 Thanks, Alex.




--
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/laurie


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



Re: Validation question

2005-02-10 Thread Niall Pemberton
Not yet.

- Original Message - 
From: "kjc" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" 
Sent: Thursday, February 10, 2005 8:04 PM
Subject: Validation question


> Is it possible to pass the incorrect field value that was entered by the 
> user
> to the error message such that
> 
>  errors.email={0} is an invalid e-mail address.
> 
>  gets generated as
> 
>"someIncorrectEmailAddr" is an invalid e-mail address



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



Re: validation question

2004-10-18 Thread Justy Wong
oh I found that my implementation will let user skip my
validation and directly execute the action.

- Original Message - 
From: "Justy Wong" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, October 19, 2004 1:48 PM
Subject: Re: validation question


> Thanks!!! I tried your last suggestion and it works fine!!!
>
> public ActionErrors validate(ActionMapping actionMapping,
HttpServletRequest
> httpServletRequest) {
> if (getCheck()==null) {
> return null;
> } else {
> return super.validate(actionMapping, httpServletRequest);
> }
> }
>
>
>
> - Original Message - 
> From: "Joe Hertz" <[EMAIL PROTECTED]>
> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> Sent: Tuesday, October 19, 2004 11:43 AM
> Subject: RE: validation question
>
>
> > > Joe, do u mean checking the field with "validwhen" using
> > > validation.xml or
> > > implement the actionForm.validate() ?
> > > I really want to use the basic struts validation framework instead of
> > > implementing validate() function to minimize the maintainence cost.
> >
> >
> > You can do it both ways.
> >
> > Use validation.xml, but ALSO define your own validate() that checks the
> > "should I validate property".
> >
> > All you have to do to get the validation framework to do it's thing is
to
> > call super.vallidate() in your own validate() method.
> >
> > -Some Other Joe
> >
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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



Re: validation question

2004-10-18 Thread Justy Wong
Thanks!!! I tried your last suggestion and it works fine!!!

public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest
httpServletRequest) {
if (getCheck()==null) {
return null;
} else {
return super.validate(actionMapping, httpServletRequest);
}
}



- Original Message - 
From: "Joe Hertz" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Tuesday, October 19, 2004 11:43 AM
Subject: RE: validation question


> > Joe, do u mean checking the field with "validwhen" using
> > validation.xml or
> > implement the actionForm.validate() ?
> > I really want to use the basic struts validation framework instead of
> > implementing validate() function to minimize the maintainence cost.
>
>
> You can do it both ways.
>
> Use validation.xml, but ALSO define your own validate() that checks the
> "should I validate property".
>
> All you have to do to get the validation framework to do it's thing is to
> call super.vallidate() in your own validate() method.
>
> -Some Other Joe
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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



RE: validation question

2004-10-18 Thread Joe Hertz
> Joe, do u mean checking the field with "validwhen" using
> validation.xml or
> implement the actionForm.validate() ?
> I really want to use the basic struts validation framework instead of
> implementing validate() function to minimize the maintainence cost.


You can do it both ways.

Use validation.xml, but ALSO define your own validate() that checks the
"should I validate property".

All you have to do to get the validation framework to do it's thing is to
call super.vallidate() in your own validate() method.

-Some Other Joe



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



Re: validation question

2004-10-18 Thread Justy Wong
Thanks for all!!

>From Joe:
> > On the other hand, if you actually have this situation, you don't have
to
> > turn off validation -- simply implement your validation rules so that
they
> > can recognize the distinction.  For example, have all your forms submit
a
> > hidden field, and have your validation method only evaluate its
validation
> > rules if that field has a defined value. When the page is retrieved
> > without a form submission, this value is not going to be defined.

Joe, do u mean checking the field with "validwhen" using validation.xml or
implement the actionForm.validate() ?
I really want to use the basic struts validation framework instead of
implementing validate() function to minimize the maintainence cost.

>From Eddie:
> Nope.  Perhaps in time the Validation framework will evolve to be smart
> enough that it "knows" (or can) that it doesn't need to validate the form
on
> the first display.  I'm actually kind of surprised this behavior hasn't
been
> added in by now.  Seems it would be simple enough to do, but, perhaps I'm
> oversimplifying in my head.

Thanks for your answer!! that means I've no other choices apart from
changing my program

- Original Message - 
From: "Eddie Bush" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, October 19, 2004 10:53 AM
Subject: Re: validation question


> Nice trick, Joe - hadn't thought of doing that :-)
>
> - Original Message ----- 
> From: "Joe Germuska" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Monday, October 18, 2004 9:40 PM
> Subject: Re: validation question
>
>
> > At 10:28 AM +0800 10/19/04, Justy Wong wrote:
> >>Thx for your suggestions.
> >>
> >>>  1) 2 action mappings -- 1 with validation turned off (welcome.do) and
1
> >>with it on (login.do).
> >>
> >>that means for every action, I've to create 1 more action. but it will
> >>almost double the maintainence affort.
> >
> > In practice, it's rare that you actually have a webapp where every
single
> > page is sometimes accessed as the result of a form submission and
> > sometimes as a simple HTTP GET.  And especially unlikely that you would
> > have this to the scope where the actual dual maintenance is a serious
> > burden.  At least, in my experience, this is simply "the right way to do
> > it."
> >
> > On the other hand, if you actually have this situation, you don't have
to
> > turn off validation -- simply implement your validation rules so that
they
> > can recognize the distinction.  For example, have all your forms submit
a
> > hidden field, and have your validation method only evaluate its
validation
> > rules if that field has a defined value. When the page is retrieved
> > without a form submission, this value is not going to be defined.
> >
> > Remember that you can implement the "validate()" method of your
> > ActionForms anyway you like.
> >
> > Joe
> >
> > -- 
> > Joe Germuska[EMAIL PROTECTED]  http://blog.germuska.com
"In
> > fact, when I die, if I don't hear 'A Love Supreme,' I'll turn back; I'll
> > know I'm in the wrong place."
> >- Carlos Santana
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
>
> ---
> avast! Antivirus: Outbound message clean.
> Virus Database (VPS): 0442-3, 10/15/2004
> Tested on: 10/18/2004 9:53:40 PM
> avast! - copyright (c) 2000-2004 ALWIL Software.
> http://www.avast.com
>
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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



Re: validation question

2004-10-18 Thread Eddie Bush
Nice trick, Joe - hadn't thought of doing that :-)
- Original Message - 
From: "Joe Germuska" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Monday, October 18, 2004 9:40 PM
Subject: Re: validation question


At 10:28 AM +0800 10/19/04, Justy Wong wrote:
Thx for your suggestions.
 1) 2 action mappings -- 1 with validation turned off (welcome.do) and 1
with it on (login.do).
that means for every action, I've to create 1 more action. but it will
almost double the maintainence affort.
In practice, it's rare that you actually have a webapp where every single 
page is sometimes accessed as the result of a form submission and 
sometimes as a simple HTTP GET.  And especially unlikely that you would 
have this to the scope where the actual dual maintenance is a serious 
burden.  At least, in my experience, this is simply "the right way to do 
it."

On the other hand, if you actually have this situation, you don't have to 
turn off validation -- simply implement your validation rules so that they 
can recognize the distinction.  For example, have all your forms submit a 
hidden field, and have your validation method only evaluate its validation 
rules if that field has a defined value. When the page is retrieved 
without a form submission, this value is not going to be defined.

Remember that you can implement the "validate()" method of your 
ActionForms anyway you like.

Joe
--
Joe Germuska[EMAIL PROTECTED]  http://blog.germuska.com"In 
fact, when I die, if I don't hear 'A Love Supreme,' I'll turn back; I'll 
know I'm in the wrong place."
   - Carlos Santana

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

---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 0442-3, 10/15/2004
Tested on: 10/18/2004 9:53:40 PM
avast! - copyright (c) 2000-2004 ALWIL Software.
http://www.avast.com

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


Re: validation question

2004-10-18 Thread Eddie Bush
- Original Message - 
From: "Justy Wong" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Monday, October 18, 2004 9:28 PM
Subject: Re: validation question


Thx for your suggestions.
1) 2 action mappings -- 1 with validation turned off (welcome.do) and 1
with it on (login.do).
that means for every action, I've to create 1 more action. but it will
almost double the maintainence affort.
Uhm ... don't think so.  You could have a simple forward setup for the 
initial display of the form.  Then, have your actual "meat and potatoes" 
action.  That's two actions alright, but you only need to code one of them 
...

Realize, when many say "an action", they mean an entry in the XML file. 
Sounds to me like you're thinking two seperate classes.

2) Turn validation off, and handle that in the action:
then I've to give up struts validation framework
Yep.  ... but you wouldn't have to have the extra action mapping.
I think these 2 suggestions are simple workaround for this problem, 
however,
it will break the framework in some degree
Is there any other solutions come with Struts??
Nope.  Perhaps in time the Validation framework will evolve to be smart 
enough that it "knows" (or can) that it doesn't need to validate the form on 
the first display.  I'm actually kind of surprised this behavior hasn't been 
added in by now.  Seems it would be simple enough to do, but, perhaps I'm 
oversimplifying in my head.

Thanks!
Justy
- Original Message - 
From: "Durham David R Jr Contr 805 CSPTS/SCE" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, October 19, 2004 1:23 AM
Subject: RE: validation question


> The validation works fine however, when I just type the
http://localhost:8080/login.do
> in my browser (no submit), the validation error will show up at once.
> I understand that it's just like I submit a form to login.do action
without any
> parameter. My question is, do struts provide any simple method to
avoid this and just
> show no error message?
There's a few different ways to handle this problem.
1) 2 action mappings -- 1 with validation turned off (welcome.do) and 1
with it on (login.do).
2) Turn validation off, and handle that in the action:
login.do
if (isSubmitted) {
errors = form.validate()
// redirect or do other authenticate work
} else {
return mapping.findForward("login");
}
HTH,
Dave
-
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]

---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 0442-3, 10/15/2004
Tested on: 10/18/2004 9:49:09 PM
avast! - copyright (c) 2000-2004 ALWIL Software.
http://www.avast.com

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


Re: validation question

2004-10-18 Thread Joe Germuska
At 10:28 AM +0800 10/19/04, Justy Wong wrote:
Thx for your suggestions.
 1) 2 action mappings -- 1 with validation turned off (welcome.do) and 1
with it on (login.do).
that means for every action, I've to create 1 more action. but it will
almost double the maintainence affort.
In practice, it's rare that you actually have a webapp where every 
single page is sometimes accessed as the result of a form submission 
and sometimes as a simple HTTP GET.  And especially unlikely that you 
would have this to the scope where the actual dual maintenance is a 
serious burden.  At least, in my experience, this is simply "the 
right way to do it."

On the other hand, if you actually have this situation, you don't 
have to turn off validation -- simply implement your validation rules 
so that they can recognize the distinction.  For example, have all 
your forms submit a hidden field, and have your validation method 
only evaluate its validation rules if that field has a defined value. 
When the page is retrieved without a form submission, this value is 
not going to be defined.

Remember that you can implement the "validate()" method of your 
ActionForms anyway you like.

Joe
--
Joe Germuska
[EMAIL PROTECTED]  
http://blog.germuska.com
"In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn 
back; I'll know I'm in the wrong place."
   - Carlos Santana

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


Re: validation question

2004-10-18 Thread Justy Wong
Thx for your suggestions.

> 1) 2 action mappings -- 1 with validation turned off (welcome.do) and 1
with it on (login.do).

that means for every action, I've to create 1 more action. but it will
almost double the maintainence affort.

> 2) Turn validation off, and handle that in the action:

then I've to give up struts validation framework

I think these 2 suggestions are simple workaround for this problem, however,
it will break the framework in some degree
Is there any other solutions come with Struts??

Thanks!
Justy

- Original Message - 
From: "Durham David R Jr Contr 805 CSPTS/SCE" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, October 19, 2004 1:23 AM
Subject: RE: validation question


> > The validation works fine however, when I just type the
> http://localhost:8080/login.do
> > in my browser (no submit), the validation error will show up at once.
> > I understand that it's just like I submit a form to login.do action
> without any
> > parameter. My question is, do struts provide any simple method to
> avoid this and just
> > show no error message?
>
> There's a few different ways to handle this problem.
>
> 1) 2 action mappings -- 1 with validation turned off (welcome.do) and 1
> with it on (login.do).
>
> 2) Turn validation off, and handle that in the action:
>
> login.do
>
> if (isSubmitted) {
> errors = form.validate()
> // redirect or do other authenticate work
> } else {
> return mapping.findForward("login");
> }
>
> HTH,
>
> Dave
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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



RE: validation question

2004-10-18 Thread Durham David R Jr Contr 805 CSPTS/SCE
> The validation works fine however, when I just type the
http://localhost:8080/login.do 
> in my browser (no submit), the validation error will show up at once.
> I understand that it's just like I submit a form to login.do action
without any 
> parameter. My question is, do struts provide any simple method to
avoid this and just 
> show no error message?

There's a few different ways to handle this problem.

1) 2 action mappings -- 1 with validation turned off (welcome.do) and 1
with it on (login.do).

2) Turn validation off, and handle that in the action:

login.do

if (isSubmitted) {
errors = form.validate()
// redirect or do other authenticate work
} else {
return mapping.findForward("login");
}

HTH,

Dave


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



Re: validation question

2004-10-18 Thread Yves Sy
Hi,

Struts doesn't have anything like that.

IMHO, I also think that using validator on the login page is not good
practice as it would give malicious users a good idea on how your app
handles authentication.

Usually, you'd just return a generic error message such as
"Username/password invalid" whenever login fails (or in your case, the
user directly types /login.do in the browser). Try not to give out any
information as much as possible.

Regards,
-Yves-


On Mon, 18 Oct 2004 17:32:31 +0800, Justy Wong <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I have a http://localhost:8080/login.do action and I want to do validation for the 
> form when user submit their username & password.
> 
> here is my setting in validation.xml:
> 
> 
> 
> 
> 
> 
> 
> 
> mask
> ^[0-9a-zA-Z]*$
> 
> 
> 
> 
> The validation works fine however, when I just type the 
> http://localhost:8080/login.do in my browser (no submit), the validation error will 
> show up at once.
> I understand that it's just like I submit a form to login.do action without any 
> parameter.
> My question is, do struts provide any simple method to avoid this and just show no 
> error message? Thanks a lot!!!
> 
> Justy
> 


-- 
For me to poop on!
http://www.formetopoopon.com
http://www.nbc.com/nbc/Late_Night_with_Conan_O'Brien/video/triumph.shtml

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



RE: Validation question. Disallow < > characters using regex mask

2004-08-02 Thread Kris Barnhoorn
Correction:

...

...

-Oorspronkelijk bericht-
Van: Kris Barnhoorn [mailto:[EMAIL PROTECTED] 
Verzonden: maandag 2 augustus 2004 22:42
Aan: 'Struts Users Mailing List'
Onderwerp: RE: Validation question. Disallow < > characters using regex
mask

Had the same problem

Solution:
...

...


kris

-Oorspronkelijk bericht-
Van: Eric Dahnke [mailto:[EMAIL PROTECTED] 
Verzonden: dinsdag 18 mei 2004 20:24
Aan: Struts Users Mailing List
Onderwerp: Validation question. Disallow < > characters using regex mask


Hello List,

Validation works great! However, we don't want to allow people to enter 



Style data into our forms. I'm happy to just make < > illegal characters
using a regex mask, but the SAX parser won't parse my validation.xml
file.
Does anyone know how to escape < > characters in the validation.xml file
or
otherwise suggest a workaround to stop people from entering html style
chars
in our forms.






maxlength
100


mask
(I've tried all of the following)
^[^<>]*
^[^<>]*
^[^\<\>]*
etc...




Thx - Eric


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



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



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



RE: Validation question. Disallow < > characters using regex mask

2004-08-02 Thread Kris Barnhoorn
Had the same problem

Solution:
...

...


kris

-Oorspronkelijk bericht-
Van: Eric Dahnke [mailto:[EMAIL PROTECTED] 
Verzonden: dinsdag 18 mei 2004 20:24
Aan: Struts Users Mailing List
Onderwerp: Validation question. Disallow < > characters using regex mask


Hello List,

Validation works great! However, we don't want to allow people to enter 



Style data into our forms. I'm happy to just make < > illegal characters
using a regex mask, but the SAX parser won't parse my validation.xml
file.
Does anyone know how to escape < > characters in the validation.xml file
or
otherwise suggest a workaround to stop people from entering html style
chars
in our forms.






maxlength
100


mask
(I've tried all of the following)
^[^<>]*
^[^<>]*
^[^\<\>]*
etc...




Thx - Eric


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