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



validation question

2010-01-07 Thread 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

 



[Struts 1.3] Validation question

2009-01-14 Thread Lorenzo Carnevale
My application user has to insert a monetary value for an invoice.
Can I use the v alidator to check the value to be greater than 0, but without 
specifying a max value?


RE: Advanced Struts 2 Validation Question...

2008-11-13 Thread Shannon, Andrew
I'd have to second that.  Writing validation in java code that is.
We've been creating a few different patterns to try and do this in an
intelligent manner, especially where we might need to go to the database
and get some data or rules or something.  I think one of the biggest
benefits about this is that we can unit test the heck out of it to our
satisfaction which alleviates the burden of working through all the
validation machinatinos in web-based integration tests as well as
trimming real people testing time which is important for the tight
budget on my current project.

- Andrew

-Original Message-
From: Burton Rhodes [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 13, 2008 11:25 AM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: Re: Advanced Struts 2 Validation Question...

Thanks to all!  Implementing Validatable was simple and works great.
I am thinking of moving all my action objects that need it to
Validatable. per Bill's suggestion...  one less file to worry about.
:)

On Thu, Nov 13, 2008 at 9:58 AM, Dave Newton <[EMAIL PROTECTED]>
wrote:
> --- On Thu, 11/13/08, Burton Rhodes wrote:
>> How do I use validation in an [Action]-validation.xml file
>> to validate several fields?
>>
>> I need to implement the following logic for 3 fields on a
>> form: Company, FirstName, LastName.
>>
>> Psedo Code:
>>
>> If Company empty, then FirstName and LastName must be filled
>> If FirstName and LastName empty, then Company Must be filled.
>>
>> I am having trouble seeing how this can be accomplished
>> with the "expression" validator type.
>
> Besides the expression help already provided, I'd add that personally
I'd put this in the Java code rather than in the XML file.
>
> It's probably just me, so take it with a grain of salt--as soon as
anything gets even a little bit complicated (this usage might not
qualify as "complicated" since it's trivial, so it's on the edge) I'll
put it in a validate() method, possibly calling super.validate() to
handle simple XML-based validations. It's (generally) easier to debug in
the Java code.
>
> With regards to doing it via JavaScript, sure, that's a viable
solution, but until I actually *apply* my patch to allow quick and easy
custom JavaScript validations you'll have to take the route of modifying
the template as another poster mentioned, or do it a bit more outside of
the S2 JavaScript validation.
>
> (Hopefully I'll get to the patch this weekend, and I'll put it in a
JIRA issue including the patch so people can use it with
previously-released versions.)
>
> 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: Advanced Struts 2 Validation Question...

2008-11-13 Thread Burton Rhodes
Thanks to all!  Implementing Validatable was simple and works great.
I am thinking of moving all my action objects that need it to
Validatable. per Bill's suggestion...  one less file to worry about.
:)

On Thu, Nov 13, 2008 at 9:58 AM, Dave Newton <[EMAIL PROTECTED]> wrote:
> --- On Thu, 11/13/08, Burton Rhodes wrote:
>> How do I use validation in an [Action]-validation.xml file
>> to validate several fields?
>>
>> I need to implement the following logic for 3 fields on a
>> form: Company, FirstName, LastName.
>>
>> Psedo Code:
>>
>> If Company empty, then FirstName and LastName must be filled
>> If FirstName and LastName empty, then Company Must be filled.
>>
>> I am having trouble seeing how this can be accomplished
>> with the "expression" validator type.
>
> Besides the expression help already provided, I'd add that personally I'd put 
> this in the Java code rather than in the XML file.
>
> It's probably just me, so take it with a grain of salt--as soon as anything 
> gets even a little bit complicated (this usage might not qualify as 
> "complicated" since it's trivial, so it's on the edge) I'll put it in a 
> validate() method, possibly calling super.validate() to handle simple 
> XML-based validations. It's (generally) easier to debug in the Java code.
>
> With regards to doing it via JavaScript, sure, that's a viable solution, but 
> until I actually *apply* my patch to allow quick and easy custom JavaScript 
> validations you'll have to take the route of modifying the template as 
> another poster mentioned, or do it a bit more outside of the S2 JavaScript 
> validation.
>
> (Hopefully I'll get to the patch this weekend, and I'll put it in a JIRA 
> issue including the patch so people can use it with previously-released 
> versions.)
>
> 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: Advanced Struts 2 Validation Question...

2008-11-13 Thread Dave Newton
--- On Thu, 11/13/08, Burton Rhodes wrote:
> How do I use validation in an [Action]-validation.xml file
> to validate several fields?
> 
> I need to implement the following logic for 3 fields on a
> form: Company, FirstName, LastName.
> 
> Psedo Code:
> 
> If Company empty, then FirstName and LastName must be filled
> If FirstName and LastName empty, then Company Must be filled.
> 
> I am having trouble seeing how this can be accomplished
> with the "expression" validator type.

Besides the expression help already provided, I'd add that personally I'd put 
this in the Java code rather than in the XML file.

It's probably just me, so take it with a grain of salt--as soon as anything 
gets even a little bit complicated (this usage might not qualify as 
"complicated" since it's trivial, so it's on the edge) I'll put it in a 
validate() method, possibly calling super.validate() to handle simple XML-based 
validations. It's (generally) easier to debug in the Java code.

With regards to doing it via JavaScript, sure, that's a viable solution, but 
until I actually *apply* my patch to allow quick and easy custom JavaScript 
validations you'll have to take the route of modifying the template as another 
poster mentioned, or do it a bit more outside of the S2 JavaScript validation.

(Hopefully I'll get to the patch this weekend, and I'll put it in a JIRA issue 
including the patch so people can use it with previously-released versions.)

Dave


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



RE: Advanced Struts 2 Validation Question...

2008-11-13 Thread Jishnu Viswanath
You can write java validation 

Try like this in xml


 FirstName 




Regards,

Jishnu Viswanath

Software Engineer

*(+9180)41190300 - 222(Ext) ll * ( + 91 ) 9731209330ll

Tavant Technologies Inc.,

www.tavant.com

PEOPLE :: PASSION :: EXCELLENCE

-Original Message-
From: Burton Rhodes [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 13, 2008 9:06 PM
To: Struts Users Mailing List
Subject: Advanced Struts 2 Validation Question...

How do I use validation in an [Action]-validation.xml file to validate
several fields?

I need to implement the following logic for 3 fields on a form:
Company, FirstName, LastName.

Psedo Code:

If Company empty, then FirstName and LastName must be filled
If FirstName and LastName empty, then Company Must be filled.

I am having trouble seeing how this can be accomplished with the
"expression" validator type.

Or should I just write some simple javascript to make this happen?!

Thanks!!
Burton

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

Any comments or statements made in this email are not necessarily those of 
Tavant Technologies.
The information transmitted is intended only for the person or entity to which 
it is addressed and may 
contain confidential and/or privileged material. If you have received this in 
error, please contact the 
sender and delete the material from any computer. All e-mails sent from or to 
Tavant Technologies 
may be subject to our monitoring procedures.


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



Re: Advanced Struts 2 Validation Question...

2008-11-13 Thread Bill Harper
Implement Valiadateable in your action and the Workflow interceptor will
call validate() before and action method  If your validate() method adds
ActionErrors then the messages go back to the input form.  You will also
need to configure / annotate an "input" result.  I can't remember off the
top of my head if you need to implement ValidationAware as well in order to
get the methods to add errors and messages.

-bill

On Thu, Nov 13, 2008 at 9:36 AM, Burton Rhodes <[EMAIL PROTECTED]>wrote:

> How do I use validation in an [Action]-validation.xml file to validate
> several fields?
>
> I need to implement the following logic for 3 fields on a form:
> Company, FirstName, LastName.
>
> Psedo Code:
>
> If Company empty, then FirstName and LastName must be filled
> If FirstName and LastName empty, then Company Must be filled.
>
> I am having trouble seeing how this can be accomplished with the
> "expression" validator type.
>
> Or should I just write some simple javascript to make this happen?!
>
> Thanks!!
> Burton
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
-bill
816.841.4755


Re: Advanced Struts 2 Validation Question...

2008-11-13 Thread Néstor Boscán
if you want javascript validation you will have to create your own theme and
own validation. You will have to create your own validator class and modify
the form-close-validation.ftl. This is what I've done in the past. Once you
figure out the details you start creating and reusing validators.

On Thu, Nov 13, 2008 at 11:06 AM, Burton Rhodes <[EMAIL PROTECTED]>wrote:

> How do I use validation in an [Action]-validation.xml file to validate
> several fields?
>
> I need to implement the following logic for 3 fields on a form:
> Company, FirstName, LastName.
>
> Psedo Code:
>
> If Company empty, then FirstName and LastName must be filled
> If FirstName and LastName empty, then Company Must be filled.
>
> I am having trouble seeing how this can be accomplished with the
> "expression" validator type.
>
> Or should I just write some simple javascript to make this happen?!
>
> Thanks!!
> Burton
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Advanced Struts 2 Validation Question...

2008-11-13 Thread Burton Rhodes
How do I use validation in an [Action]-validation.xml file to validate
several fields?

I need to implement the following logic for 3 fields on a form:
Company, FirstName, LastName.

Psedo Code:

If Company empty, then FirstName and LastName must be filled
If FirstName and LastName empty, then Company Must be filled.

I am having trouble seeing how this can be accomplished with the
"expression" validator type.

Or should I just write some simple javascript to make this happen?!

Thanks!!
Burton

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



Re: simple vs xhtml theme, validation question

2008-10-09 Thread Torsten Krah
Am Mittwoch, 8. Oktober 2008 20:27:40 schrieb Gabriel Belingueres:
> You can do it by hand though:

Thx for this hint, should habe seen that myself. Thats a good idea to do stuff 
with s:if and s:else myself. thx.

-- 
Bitte senden Sie mir keine Word- oder PowerPoint-Anhänge.
Siehe http://www.gnu.org/philosophy/no-word-attachments.de.html

Really, I'm not out to destroy Microsoft. That will just be a 
completely unintentional side effect."
-- Linus Torvalds


smime.p7s
Description: S/MIME cryptographic signature


Re: simple vs xhtml theme, validation question

2008-10-08 Thread Gabriel Belingueres
You can do it by hand though:


  

  


In addition, if you are using S2.1, then you have a basic error
handling. Each tag has an cssErrorClass and cssErrorStyle attributes
that are set when there is a validation error.

2008/10/8 Sébastien Domergue <[EMAIL PROTECTED]>:
> Hi,
> you're right, simple theme don't allow you to use validation. In order to
> use validation with the simple theme you have to extend it or to modify
> xhtml theme in order not to build the table layout.
> The templates sources are in struts jar and you can define others by adding
> them to struts.properties.
> You also have the actionerror and actionmessage tags that can display those
> messages but they will be all displayed at the same place.
>
> Regards
>
> Sébastien
>
> Torsten Krah a écrit :
>>
>> Hi.
>> I don't want to use the xhtml theme because of the table layout it
>> produces, the simple is enough.
>> However, simple does not render the validation errors or messages.
>>
>> Wheres the glue to do so with the simple theme? Did not find any
>> information about this yet which helps me, to render those messages.
>>
>> Any help appreciated. thx.
>>
>>
>
>
> -
> 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: simple vs xhtml theme, validation question

2008-10-08 Thread Sébastien Domergue

Hi,
you're right, simple theme don't allow you to use validation. In order 
to use validation with the simple theme you have to extend it or to 
modify xhtml theme in order not to build the table layout.
The templates sources are in struts jar and you can define others by 
adding them to struts.properties.
You also have the actionerror and actionmessage tags that can display 
those messages but they will be all displayed at the same place.


Regards

Sébastien

Torsten Krah a écrit :

Hi.
I don't want to use the xhtml theme because of the table layout it produces, 
the simple is enough.

However, simple does not render the validation errors or messages.

Wheres the glue to do so with the simple theme? Did not find any information 
about this yet which helps me, to render those messages.


Any help appreciated. thx.

  


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

Re: simple vs xhtml theme, validation question

2008-10-08 Thread Lukasz Lenart
2008/10/8 Torsten Krah <[EMAIL PROTECTED]>:
> I don't want to use the xhtml theme because of the table layout it produces,
> the simple is enough.
> However, simple does not render the validation errors or messages.

You can use css_xhtml theme [1]

> Wheres the glue to do so with the simple theme? Did not find any information
> about this yet which helps me, to render those messages.

Selecting theme [2]


[1] http://struts.apache.org/2.0.11.2/docs/cssxhtml-theme.html
[2] http://struts.apache.org/2.0.11.2/docs/selecting-themes.html


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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



simple vs xhtml theme, validation question

2008-10-08 Thread Torsten Krah
Hi.
I don't want to use the xhtml theme because of the table layout it produces, 
the simple is enough.
However, simple does not render the validation errors or messages.

Wheres the glue to do so with the simple theme? Did not find any information 
about this yet which helps me, to render those messages.

Any help appreciated. thx.

-- 
Bitte senden Sie mir keine Word- oder PowerPoint-Anhänge.
Siehe http://www.gnu.org/philosophy/no-word-attachments.de.html

Really, I'm not out to destroy Microsoft. That will just be a 
completely unintentional side effect."
-- Linus Torvalds


smime.p7s
Description: S/MIME cryptographic signature


Struts Custom Validation Question

2008-07-22 Thread Chandramouli P

Hi,

I have the below scenario in our application.

Consider we have two radio buttons for two types of bank accounts, say Savings 
and Current, and based on the selection of each radio button we are 
enabling/disabling some fields for user input, which in turn, the properties of 
an ActionForm.

What my question is, when we select the first radio button and fills/clears the 
values and submitting the form only a set of validations to be performed and in 
the case of second radio button also we are doing the same thing. How can I 
implement a custom validation for this scenario? And also please note that the 
radio button is also a property of the ActionForm.

Thanks in Advance,
Chandra.
_
Wish to Marry Now? Click Here to Register FREE
http://www.shaadi.com/registration/user/index.php?ptnr=mhottag
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts2 regex validation question

2008-05-02 Thread Laurie Harper

Pranav wrote:

Hi,

I want to put a validation in struts2 using field-validator type="regex" such that any 
string which contains any of the <, > or any of the alternative representation like < 
should return a validation failure message. How do I do that?. I believe that if I give a pattern 
to regex, it shows error message if it DOES NOT match the pattern but here I know the pattern which 
the input field must not match in order to be valid. Any help?


 [i 
want to provide a pattern such that the input string does not match it]
Input has invalid characters



Try 

Struts2 regex validation question

2008-05-02 Thread Pranav
Hi,

I want to put a validation in struts2 using field-validator type="regex" such 
that any string which contains any of the <, > or any of the alternative 
representation like < should return a validation failure message. How do I 
do that?. I believe that if I give a pattern to regex, it shows error message 
if it DOES NOT match the pattern but here I know the pattern which the input 
field must not match in order to be valid. Any help?


 [i 
want to provide a pattern such that the input string does not match it]
Input has invalid characters



Thanks
Pranav



  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

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



[S2] validation on list of bean (was Validation question)

2008-01-08 Thread Martin Braure de Calignon

Le mardi 08 janvier 2008 à 14:08 +0100, Martin Braure de Calignon a
écrit :

Sorry I've forgot [S2] in subject
> 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


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


Validation question

2008-01-08 Thread Martin Braure de Calignon
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


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


Re: Struts2 Validation Question

2006-10-17 Thread Ted Husted

S2 Validation follows a "config-behind-class" model. You define a
validation file for the Action class (or other JavaBean) that needs to
be validated, and place it in the same package/folder. The validation
follows the class hierarchy, so that if a class is extended, the
subclass inherits the validator. There is also an alternative syntax
so that you can specify a validation for a particular method on an
Action class. The latter is helpful when you are passing several
"CRUD" methods through the same Aciton class, dispatch-style.

For more, see

* http://cwiki.apache.org/WW/validation.html

-- HTH, Ted.
* http://www.husted.com/struts/

On 10/17/06, Jim Reynolds <[EMAIL PROTECTED]> wrote:

Downloaded and extracted the struts2-showcase-2.0.1.war file to my
tomcat server. I am looking at the validation/quizBasic!input.action
and I am confused on how the validtion on these fields is set. I am
accustomzed to using 1.x.

Could someone please explain how the validation for these three fields works?

Thanks,


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



Struts2 Validation Question

2006-10-17 Thread Jim Reynolds

Downloaded and extracted the struts2-showcase-2.0.1.war file to my
tomcat server. I am looking at the validation/quizBasic!input.action
and I am confused on how the validtion on these fields is set. I am
accustomzed to using 1.x.

Could someone please explain how the validation for these three fields works?

Thanks,

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



RE: Struts validation question

2006-07-04 Thread hermod.opstvedt
Hi

You also need to put in "... onSubmit="return validateValidationForm(this);" in 
your html:form tag.

Also: you should name your forms like: validationForm, not ValidationForm.

Hermod

-Original Message-
From: red phoenix [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 04, 2006 9:38 AM
To: user@struts.apache.org
Subject: Struts validation question


I want to use struts validation,when field is invalidate,my program can
raise information,like follows:
Username is required.
Password is required.
Phone Number is required.

I know it's server-side validation,I want to use client-side validation,so I
put some code in my JSP files:



When I run this JSP and put some invalidation in fields,I find Javascript
don't work at all,it still raise follows:
Username is required.
Password is required.
Phone Number is required.
My JDK is 1.6,tomcat5.5.17 and struts is 1.2.9,I want to know if struts is
1.2.9 change the method of supporting client-side validation?

Any idea will be appreciated!


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

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

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

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


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



Struts validation question

2006-07-04 Thread red phoenix

I want to use struts validation,when field is invalidate,my program can
raise information,like follows:
Username is required.
Password is required.
Phone Number is required.

I know it's server-side validation,I want to use client-side validation,so I
put some code in my JSP files:



When I run this JSP and put some invalidation in fields,I find Javascript
don't work at all,it still raise follows:
Username is required.
Password is required.
Phone Number is required.
My JDK is 1.6,tomcat5.5.17 and struts is 1.2.9,I want to know if struts is
1.2.9 change the method of supporting client-side validation?

Any idea will be appreciated!


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]



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

2005-11-04 Thread Troy Bull

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: Beans in Request and Validation Question

2005-11-01 Thread Hubert Rabago
The way I dealt with this was to point my "input" attribute to a setup
Action which would put the needed collection into request scope for
me.  But that's just one approach.  Another is to handle validation
yourself (which really is very easy).  This is the approach
recommended by http://www.reumann.net/struts/articles/request_lists.jsp.
 That page actually lists a few approaches, though I would shorten my
list to the last three (plus the setup input Action).

Hubert

On 11/1/05, Jim Reynolds <[EMAIL PROTECTED]> wrote:
> I have a question about using request scoped beans and validation with an
> ActionForm.
>  Here is a example:
> In a certain action, I go and create a Collection of objects for a select
> list. I put the Collection into the request, and forward to a JSP page, and
> I show the list.
>  From the JSP page, the user is required to select an item from the select
> list, then hit submit. Here is where the issues come into play. From that
> action I am validating the form in the bean. If the user forgot to select an
> item, I create ActionError, stuff it into the ActionErrors object and send
> back to my input which is the original jsp page with the select list, the
> one they just submitted from.
>  But of course, when it goes back to the jsp page, there is no collection to
> build the select list, and I get errors. Up to now, I have been putting
> those types of list into the session, but really feel there should be a
> better way. Can anyone possibly guide me here to a better way to handle
> this?
>
>

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



Beans in Request and Validation Question

2005-11-01 Thread Jim Reynolds
I have a question about using request scoped beans and validation with an
ActionForm.
 Here is a example:
In a certain action, I go and create a Collection of objects for a select
list. I put the Collection into the request, and forward to a JSP page, and
I show the list.
 From the JSP page, the user is required to select an item from the select
list, then hit submit. Here is where the issues come into play. From that
action I am validating the form in the bean. If the user forgot to select an
item, I create ActionError, stuff it into the ActionErrors object and send
back to my input which is the original jsp page with the select list, the
one they just submitted from.
 But of course, when it goes back to the jsp page, there is no collection to
build the select list, and I get errors. Up to now, I have been putting
those types of list into the session, but really feel there should be a
better way. Can anyone possibly guide me here to a better way to handle
this?


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]



validation question...

2005-07-21 Thread Aleksandar Matijaca
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.


RE: Automatic validation question...

2005-06-01 Thread Durham David R Jr Ctr 805 CSPTS/SCE
> -Original Message-
> From: N G [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, May 31, 2005 3:37 PM
> To: Struts-user
> Subject: Automatic validation question...
> 
> If I have set up validation as follows:
> 
> 
>   
> 
>   test
>   (radioButton = "firstNameSearch")var-value>
> 
> 
> 
> If "validwhen" failts, will it try to validate the "required"?

I'm pretty sure it will go through all of the "depends" so that it can
display *all* of the validation errors.  Try it and see.

- Dave 

> In other words, when using automatic validation, the validator goes
> through the list in "depends" and quits as soon as something is not
> valid or does it keep going?
> 
> Also, does my "validwhen" look right? I have different types of
> searches on my form and depending on which search (radio button) 
> the user clicks, different fields are required. So, if the user 
> clicks on "First Name Search", the first name field will be required. 
> Did I set it up correctly?

Why not use requiredif?


- Dave

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



Automatic validation question...

2005-05-31 Thread N G
If I have set up validation as follows:


  

  test
  (radioButton = "firstNameSearch")var-value>



If "validwhen" failts, will it try to validate the "required"?

In other words, when using automatic validation, the validator goes
through the list in "depends" and quits as soon as something is not
valid or does it keep going?

Also, does my "validwhen" look right? I have different types of
searches on my form and depending on which search (radio button) the
user clicks, different fields are required. So, if the user clicks on
"First Name Search", the first name field will be required. Did I set
it up correctly?

Thanks,
NG.

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



RE: Request Processor validation Question

2005-03-14 Thread Antony Joseph
Correction.  Default implementation uses any configured roles. Your 
implementation can override this and implement whatever logic you want.

- Original Message -
From: "Antony Joseph" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" 
Subject: RE: Request Processor validation Question
Date: Mon, 14 Mar 2005 11:36:44 -0500

> 
> There is nothing special about processRoles(). It just returns true 
> by default.You can overide it and implement whatever logic you want 
> in it. It is not tied to any J2ee mechanism.
> 
> - Original Message -
> From: "Scott Purcell" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" 
> Subject: RE: Request Processor validation Question
> Date: Mon, 14 Mar 2005 10:18:34 -0600
> 
> >
> > If I use the processRoles(), does that mean I have to use the 
> > J2EE authentication mechanism for web applications? Using the 
> > container and declare the applications declaratively?
> >
> > I am using a database with form-based authentication and just 
> > want to find out whether the user is logged in, and if so he can 
> > keep working, else if he is not logged in and is trying to access 
> > a page that requires he be logged in, then take him to the front 
> > door.
> >
> > Thanks,
> > Scott
> >
> > -Original Message-----
> > From: Antony Joseph [mailto:[EMAIL PROTECTED]
> > Sent: Monday, March 14, 2005 9:56 AM
> > To: Struts Users Mailing List
> > Subject: Re: Request Processor validation Question
> >
> >
> > Hi Scott,
> > Check the javadocs for the RequestProcessor. Any method which has 
> > an ActionMapping as an argument can be used to figure out the 
> > action (ex: mapping.getPath()). If you plan to do authorization 
> > the method processRoles() is a good candidate to be overriden.
> >
> > - Original Message -
> > From: "Scott Purcell"
> > To: user@struts.apache.org
> > Subject: Request Processor validation Question
> > Date: Mon, 14 Mar 2005 09:31:35 -0600
> >
> > >
> > > Hello, I have extended the RequestProcessor and I am looking 
> > for > a way to find out where the page is going to. The reason 
> > for this > is as follows. I am giving each user a UserObject when 
> > they hit > the site. Later on, after they log in, I set some 
> > flags to know > they are valid inside the application. I am just 
> > using a boolean > "isLoggedIn". Anyway I need a way to find out 
> > which Action they > are heading to and put some logic in my 
> > extended RequestProcessor > class, that could check which Action 
> > and send them to the login, > if an action they want to use is 
> > past the login page. If I know > the action and they are just 
> > logging in, I will not show them a > "session expired" flag. But 
> > if they are heading for an inside > page (a page they need to be 
> > logged in for), and the object says > "not logged in" then of 
> > course, I want to take them to the front > door and show a msg 
> > stating "session expired.". I have gone > through the 
> > RequestProcessor docs, but do not see anyway to get > the 
> > action.? Any ideas. Thanks, Scott
> >
> >
> >
> >
> >
> >
> > Antony Joseph
> > http://www.logicden.com
> > https://workeffort.dev.java.net
> > --
> > ___
> > NEW! Lycos Dating Search. The only place to search multiple 
> > dating sites at once.
> > http://datingsearch.lycos.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]
> 
> 
> 
> Antony Joseph
> http://www.logicden.com
> https://workeffort.dev.java.net
> 
> --
> ___
> NEW! Lycos Dating Search. The only place to search multiple dating 
> sites at once.
> http://datingsearch.lycos.com
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



Antony Joseph
http://www.logicden.com
https://workeffort.dev.java.net

-- 
___
NEW! Lycos Dating Search. The only place to search multiple dating sites at 
once.
http://datingsearch.lycos.com


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



RE: Request Processor validation Question

2005-03-14 Thread Antony Joseph
There is nothing special about processRoles(). It just returns true by 
default.You can overide it and implement whatever logic you want in it. It is 
not tied to any J2ee mechanism.

- Original Message -
From: "Scott Purcell" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" 
Subject: RE: Request Processor validation Question
Date: Mon, 14 Mar 2005 10:18:34 -0600

> 
> If I use the processRoles(), does that mean I have to use the J2EE 
> authentication mechanism for web applications? Using the container 
> and declare the applications declaratively?
> 
> I am using a database with form-based authentication and just want 
> to find out whether the user is logged in, and if so he can keep 
> working, else if he is not logged in and is trying to access a page 
> that requires he be logged in, then take him to the front door.
> 
> Thanks,
> Scott
> 
> -Original Message-
> From: Antony Joseph [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 14, 2005 9:56 AM
> To: Struts Users Mailing List
> Subject: Re: Request Processor validation Question
> 
> 
> Hi Scott,
> Check the javadocs for the RequestProcessor. Any method which has 
> an ActionMapping as an argument can be used to figure out the 
> action (ex: mapping.getPath()). If you plan to do authorization the 
> method processRoles() is a good candidate to be overriden.
> 
> - Original Message -
> From: "Scott Purcell"
> To: user@struts.apache.org
> Subject: Request Processor validation Question
> Date: Mon, 14 Mar 2005 09:31:35 -0600
> 
> >
> > Hello, I have extended the RequestProcessor and I am looking for 
> > a way to find out where the page is going to. The reason for this 
> > is as follows. I am giving each user a UserObject when they hit 
> > the site. Later on, after they log in, I set some flags to know 
> > they are valid inside the application. I am just using a boolean 
> > "isLoggedIn". Anyway I need a way to find out which Action they 
> > are heading to and put some logic in my extended RequestProcessor 
> > class, that could check which Action and send them to the login, 
> > if an action they want to use is past the login page. If I know 
> > the action and they are just logging in, I will not show them a 
> > "session expired" flag. But if they are heading for an inside 
> > page (a page they need to be logged in for), and the object says 
> > "not logged in" then of course, I want to take them to the front 
> > door and show a msg stating "session expired.". I have gone 
> > through the RequestProcessor docs, but do not see anyway to get 
> > the action.? Any ideas. Thanks, Scott
> 
> 
> 
> 
> 
> 
> Antony Joseph
> http://www.logicden.com
> https://workeffort.dev.java.net
> --
> ___
> NEW! Lycos Dating Search. The only place to search multiple dating 
> sites at once.
> http://datingsearch.lycos.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]



Antony Joseph
http://www.logicden.com
https://workeffort.dev.java.net

-- 
___
NEW! Lycos Dating Search. The only place to search multiple dating sites at 
once.
http://datingsearch.lycos.com


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



RE: Request Processor validation Question

2005-03-14 Thread Scott Purcell
If I use the processRoles(), does that mean I have to use the J2EE 
authentication mechanism for web applications? Using the container and declare 
the applications declaratively?

I am using a database with form-based authentication and just want to find out 
whether the user is logged in, and if so he can keep working, else if he is not 
logged in and is trying to access a page that requires he be logged in, then 
take him to the front door.

Thanks,
Scott

-Original Message-
From: Antony Joseph [mailto:[EMAIL PROTECTED]
Sent: Monday, March 14, 2005 9:56 AM
To: Struts Users Mailing List
Subject: Re: Request Processor validation Question


Hi Scott,
Check the javadocs for the RequestProcessor. Any method which has an 
ActionMapping as an argument can be used to figure out the action (ex: 
mapping.getPath()). If you plan to do authorization the method processRoles() 
is a good candidate to be overriden.

- Original Message - 
From: "Scott Purcell" 
To: user@struts.apache.org 
Subject: Request Processor validation Question 
Date: Mon, 14 Mar 2005 09:31:35 -0600 

> 
> Hello, 
> I have extended the RequestProcessor and I am looking for a way to 
> find out where the page is going to. The reason for this is as 
> follows. I am giving each user a UserObject when they hit the site. 
> Later on, after they log in, I set some flags to know they are 
> valid inside the application. I am just using a boolean 
> "isLoggedIn". Anyway I need a way to find out which Action they are 
> heading to and put some logic in my extended RequestProcessor 
> class, that could check which Action and send them to the login, if 
> an action they want to use is past the login page. 
> 
> If I know the action and they are just logging in, I will not show 
> them a "session expired" flag. But if they are heading for an 
> inside page (a page they need to be logged in for), and the object 
> says "not logged in" then of course, I want to take them to the 
> front door and show a msg stating "session expired.". 
> 
> I have gone through the RequestProcessor docs, but do not see 
> anyway to get the action.? 
> 
> Any ideas. 
> 
> Thanks, 
> Scott 
> 
> 
> 






Antony Joseph
http://www.logicden.com
https://workeffort.dev.java.net
-- 
___
NEW! Lycos Dating Search. The only place to search multiple dating sites at 
once.
http://datingsearch.lycos.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: Request Processor validation Question

2005-03-14 Thread Antony Joseph
Hi Scott,
Check the javadocs for the RequestProcessor. Any method which has an 
ActionMapping as an argument can be used to figure out the action (ex: 
mapping.getPath()). If you plan to do authorization the method processRoles() 
is a good candidate to be overriden.

- Original Message - 
From: "Scott Purcell" 
To: user@struts.apache.org 
Subject: Request Processor validation Question 
Date: Mon, 14 Mar 2005 09:31:35 -0600 

> 
> Hello, 
> I have extended the RequestProcessor and I am looking for a way to 
> find out where the page is going to. The reason for this is as 
> follows. I am giving each user a UserObject when they hit the site. 
> Later on, after they log in, I set some flags to know they are 
> valid inside the application. I am just using a boolean 
> "isLoggedIn". Anyway I need a way to find out which Action they are 
> heading to and put some logic in my extended RequestProcessor 
> class, that could check which Action and send them to the login, if 
> an action they want to use is past the login page. 
> 
> If I know the action and they are just logging in, I will not show 
> them a "session expired" flag. But if they are heading for an 
> inside page (a page they need to be logged in for), and the object 
> says "not logged in" then of course, I want to take them to the 
> front door and show a msg stating "session expired.". 
> 
> I have gone through the RequestProcessor docs, but do not see 
> anyway to get the action.? 
> 
> Any ideas. 
> 
> Thanks, 
> Scott 
> 
> 
> 






Antony Joseph
http://www.logicden.com
https://workeffort.dev.java.net
-- 
___
NEW! Lycos Dating Search. The only place to search multiple dating sites at 
once.
http://datingsearch.lycos.com


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



Request Processor validation Question

2005-03-14 Thread Scott Purcell
Hello,
I have extended the RequestProcessor and I am looking for a way to find out 
where the page is going to. The reason for this is as follows. I am giving each 
user a UserObject when they hit the site. Later on, after they log in, I set 
some flags to know they are valid inside the application. I am just using a 
boolean "isLoggedIn". Anyway I need a way to find out which Action they are 
heading to and put some logic in my extended RequestProcessor class, that could 
check which Action and send them to the login, if an action they want to use is 
past the login page. 
 
If I know the action and they are just logging in, I will not show them a 
"session expired" flag. But if they are heading for an inside page (a page they 
need to be logged in for), and the object says "not logged in" then of course, 
I want to take them to the front door and show a msg stating "session expired.".
 
I have gone through the RequestProcessor docs, but do not see anyway to get the 
action.?
 
Any ideas.
 
Thanks,
Scott
 
 
 


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]



Validation question

2005-02-10 Thread kjc
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
Thanks in advance.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Date Validation question

2005-01-04 Thread Manisha Sathe
I am having From date - in the form of 3 separate lists for - Day, Month, Year. 
Similarly i have To date.
 
Using struts validator framework,
 
1)Firstly i want to validate whether the combined entries (day, month, year) is 
a valid date  or not
2)Secondly whether first date > to date
 
I tried to search in archive but seems no serach function is available. I am 
sure this is very common validation and can be done with struts validator. Can 
anybody guide me pls ?
 
regards
Manisha


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Struts Form Validation Question

2004-12-22 Thread Eddie Bush
LOL - I'm glad it's what you're looking for.  Consider it my Christmas
present to you.  Now, what'd you get ME? ;-)

I still don't recommend your approach :-)  You might wind up rejecting
peoples' names because they don't fit your regexp!

Good Luck!

On Wed, 22 Dec 2004 20:41:52 -0500, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Thanks for your help Eddie! Regex worked perfect.
> 
> I had given up hope on getting right regex.
> Thanks Again!
> 
> - Original Message -
> From: "Eddie Bush" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Monday, December 20, 2004 12:12 AM
> Subject: Re: Struts Form Validation Question
> 
> > ^([a-zA-Z]+['-\s])*$
> >
> > That's top of my head ... and my head is tired :-( but maybe it's
> > helpful.  You need to separate the repeating things from the
> > non-repeating things, and allow the two of them to be chained multiple
> > times.  Having such complete validation of a name seems error-prone at
> > best though, since names can take on such diverse forms.  You're
> > likely to wind up turning down someone's correct name as invalid
> > because your pattern doesn't fit their name.  I don't know about you,
> > but if you turned my name down as invalid, and I entered it correctly,
> > it would aggravate me :-)
> >
> > On Sun, 19 Dec 2004 23:36:48 -0500, [EMAIL PROTECTED]
> > <[EMAIL PROTECTED]> wrote:
> >> Hi,
> >>
> >> I am using struts validator plugin. I have form field which requires
> >> following validation:
> >> "Full Name can contain only letters, dashes (-), apsotrophes(') and
> >> single spaces"
> >>
> >> Here is the regex I am using for this validation : ^[a-zA-Z'-\s]*$
> >> The only problem with this regex is that it allows user to enter
> >> more
> >> than one consecutive blank space in the field.
> >> So I landed up putting the check for double space in the Struts Form
> >> bean Validate method.
> >>
> >> Dividing the validation in two parts has created a scenario when some
> >> time user see the same error message twice because
> >> validation failed in plugin as wells in form validate method.
> >>
> >> For the time being I have changed the two message little bit so user
> >> is
> >> not confused. But I would like to show only one message
> >> irrespective of  where the validation failed.
> >>
> >> Any Ideas ?
> >>
> >> Thanks for help!
> >>
> >> Rajesh Shah
> >
> > --
> > Eddie Bush

-- 
Eddie Bush

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



Re: Struts Form Validation Question

2004-12-22 Thread send2rajesh
Thanks for your help Eddie! Regex worked perfect.
I had given up hope on getting right regex.
Thanks Again!
- Original Message - 
From: "Eddie Bush" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Monday, December 20, 2004 12:12 AM
Subject: Re: Struts Form Validation Question


^([a-zA-Z]+['-\s])*$
That's top of my head ... and my head is tired :-( but maybe it's
helpful.  You need to separate the repeating things from the
non-repeating things, and allow the two of them to be chained multiple
times.  Having such complete validation of a name seems error-prone at
best though, since names can take on such diverse forms.  You're
likely to wind up turning down someone's correct name as invalid
because your pattern doesn't fit their name.  I don't know about you,
but if you turned my name down as invalid, and I entered it correctly,
it would aggravate me :-)
On Sun, 19 Dec 2004 23:36:48 -0500, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
Hi,
I am using struts validator plugin. I have form field which requires
following validation:
"Full Name can contain only letters, dashes (-), apsotrophes(') and
single spaces"
Here is the regex I am using for this validation : ^[a-zA-Z'-\s]*$
The only problem with this regex is that it allows user to enter 
more
than one consecutive blank space in the field.
So I landed up putting the check for double space in the Struts Form
bean Validate method.

Dividing the validation in two parts has created a scenario when some
time user see the same error message twice because
validation failed in plugin as wells in form validate method.
For the time being I have changed the two message little bit so user 
is
not confused. But I would like to show only one message
irrespective of  where the validation failed.

Any Ideas ?
Thanks for help!
Rajesh Shah
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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

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


Re: Struts Form Validation Question

2004-12-20 Thread Eddie Bush
That doesn't address the issue of having multiple - and ' characters
together.  Plus, it will only allow two-section names.  Regular
expressions are fantastic, if you can find one to suit your needs.  It
can often be difficult to arrive at an apropriate expression though
:-(  Power brings complexity ... who'da thunk it.

On Mon, 20 Dec 2004 13:52:07 +, Ruben Cepeda
<[EMAIL PROTECTED]> wrote:
> Hey,
> Why not try this regex:  ^[a-zA-Z'-]*\s[a-zA-Z'-]*$
> 
> *
> Ruben Cepeda
> [EMAIL PROTECTED]
> *
> 
> Original Message Follows
> From: <[EMAIL PROTECTED]>
> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Subject: Struts Form Validation Question
> Date: Sun, 19 Dec 2004 23:36:48 -0500
> 
> Hi,
> 
> I am using struts validator plugin. I have form field which requires
> following validation:
> "Full Name can contain only letters, dashes (-), apsotrophes(') and
> single spaces"
> 
> Here is the regex I am using for this validation : ^[a-zA-Z'-\s]*$
> The only problem with this regex is that it allows user to enter  more
> than one consecutive blank space in the field.
> So I landed up putting the check for double space in the Struts Form
> bean Validate method.
> 
> Dividing the validation in two parts has created a scenario when some
> time user see the same error message twice because
> validation failed in plugin as wells in form validate method.
> 
> For the time being I have changed the two message little bit so user is
> not confused. But I would like to show only one message
> irrespective of  where the validation failed.
> 
> Any Ideas ?
> 
> Thanks for help!
> 
> Rajesh Shah
> 

-- 
Eddie Bush

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



RE: Struts Form Validation Question

2004-12-20 Thread Ruben Cepeda
Hey,
Why not try this regex:  ^[a-zA-Z'-]*\s[a-zA-Z'-]*$

*
Ruben Cepeda
[EMAIL PROTECTED]
*

Original Message Follows
From: <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: Struts Form Validation Question
Date: Sun, 19 Dec 2004 23:36:48 -0500
Hi,
I am using struts validator plugin. I have form field which requires
following validation:
"Full Name can contain only letters, dashes (-), apsotrophes(') and
single spaces"
Here is the regex I am using for this validation : ^[a-zA-Z'-\s]*$
The only problem with this regex is that it allows user to enter  more
than one consecutive blank space in the field.
So I landed up putting the check for double space in the Struts Form
bean Validate method.
Dividing the validation in two parts has created a scenario when some
time user see the same error message twice because
validation failed in plugin as wells in form validate method.
For the time being I have changed the two message little bit so user is
not confused. But I would like to show only one message
irrespective of  where the validation failed.
Any Ideas ?
Thanks for help!
Rajesh Shah
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

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


Re: Struts Form Validation Question

2004-12-19 Thread Eddie Bush
^([a-zA-Z]+['-\s])*$

That's top of my head ... and my head is tired :-( but maybe it's
helpful.  You need to separate the repeating things from the
non-repeating things, and allow the two of them to be chained multiple
times.  Having such complete validation of a name seems error-prone at
best though, since names can take on such diverse forms.  You're
likely to wind up turning down someone's correct name as invalid
because your pattern doesn't fit their name.  I don't know about you,
but if you turned my name down as invalid, and I entered it correctly,
it would aggravate me :-)

On Sun, 19 Dec 2004 23:36:48 -0500, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I am using struts validator plugin. I have form field which requires
> following validation:
> "Full Name can contain only letters, dashes (-), apsotrophes(') and
> single spaces"
> 
> Here is the regex I am using for this validation : ^[a-zA-Z'-\s]*$
> The only problem with this regex is that it allows user to enter  more
> than one consecutive blank space in the field.
> So I landed up putting the check for double space in the Struts Form
> bean Validate method.
> 
> Dividing the validation in two parts has created a scenario when some
> time user see the same error message twice because
> validation failed in plugin as wells in form validate method.
> 
> For the time being I have changed the two message little bit so user is
> not confused. But I would like to show only one message
> irrespective of  where the validation failed.
> 
> Any Ideas ?
> 
> Thanks for help!
> 
> Rajesh Shah
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
Eddie Bush

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



Struts Form Validation Question

2004-12-19 Thread send2rajesh
Hi,
I am using struts validator plugin. I have form field which requires
following validation:
"Full Name can contain only letters, dashes (-), apsotrophes(') and
single spaces"
Here is the regex I am using for this validation : ^[a-zA-Z'-\s]*$
The only problem with this regex is that it allows user to enter  more
than one consecutive blank space in the field.
So I landed up putting the check for double space in the Struts Form
bean Validate method.
Dividing the validation in two parts has created a scenario when some
time user see the same error message twice because
validation failed in plugin as wells in form validate method.
For the time being I have changed the two message little bit so user is
not confused. But I would like to show only one message
irrespective of  where the validation failed.
Any Ideas ?
Thanks for help!
Rajesh Shah
-
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]



validation question

2004-10-18 Thread Justy Wong
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

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]



validation question (message resources)

2004-06-01 Thread Hengge Joachim
Hi All,

i'm trying to set up automatic validation (required validator), everything is working, 
except the key lookup in the message resources. Every time i submit my form i get a 
'null is required' instead of the textfield label.
I double-checked the settings about a thousand times, searched the web and the list 
archive, but couldn't located my failure. I hope you can help me, because i spent way 
too much time, trying to solve this little problem.

My settings:

struts-config.xml:
--
...







...

validation.xml:
---
...






...

ApplicationResources.properties:
-
# -- standard errors --
errors.header=
errors.prefix=
errors.suffix=
errors.footer=

#-- validation errors
errors.required={0} is required

# -- display names
addGroupDealer.groupDealerID=Group Dealer ID

tiles-jsp:
--
...


...


Thanks in advance

jo

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



Validation question. Disallow < > characters using regex mask

2004-05-18 Thread Eric Dahnke

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]



Validation question. Disallow < > characters using regex mask

2004-05-18 Thread Eric Dahnke

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]