Re: Validation Help

2012-06-22 Thread Paul Mefford
lukasz.lenart,

Thanks for your response.  I am using Struts 2.1.8, Java 1.6 and tomcat 7.

On Mon, Jun 18, 2012 at 12:02 AM, Łukasz Lenart <
lukasz.len...@googlemail.com> wrote:

> 2012/6/17 Paul Mefford :
> > Can anyone give me some advice on how to fix the .xml loader so it finds
> a
> > xml file using the wildcard in sturts.xml?  Or has anyone done this a
> > different way with validation?
>
> Struts 2 version ? App Sever ?
>
> You can implement your own logic how to handle validation using
> ActionValidatorManager interface - there are two known implementations
> - AnnotationActionValidatorManager (used by Struts 2) and
> DefaultActionValidatorManager (used be XWork when running without
> Struts 2).
>
> If you want to implement your Manager, to enable it just add the line
> below to your struts.xml
>
>  name="struts.actionValidatorManager" class="con.company.MyManager" />
>
> You can also try to debug your application and see what's going on in
> AnnotationActionValidatorManager#loadFile()
>
>
> Regards
> --
> Łukasz
> mobile +48 606 323 122 http://www.lenart.org.pl/
> Warszawa JUG conference - Confitura http://confitura.pl/
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: Validation Help

2012-06-17 Thread Łukasz Lenart
2012/6/17 Paul Mefford :
> Can anyone give me some advice on how to fix the .xml loader so it finds a
> xml file using the wildcard in sturts.xml?  Or has anyone done this a
> different way with validation?

Struts 2 version ? App Sever ?

You can implement your own logic how to handle validation using
ActionValidatorManager interface - there are two known implementations
- AnnotationActionValidatorManager (used by Struts 2) and
DefaultActionValidatorManager (used be XWork when running without
Struts 2).

If you want to implement your Manager, to enable it just add the line
below to your struts.xml



You can also try to debug your application and see what's going on in
AnnotationActionValidatorManager#loadFile()


Regards
-- 
Łukasz
mobile +48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

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



Re: Validation Help?

2008-10-15 Thread Dave Newton
Don't mistake my curtness for disgust ;)

--- On Wed, 10/15/08, David C. Hicks wrote:
> If by "zero-config" you're referring to our network, that would be 
> No. We're on a fairly standard DHCP/DNS local network here
> at the office. If you mean something else, then I'm afraid I'm
> blonde again.  :-)

Zero-config refers to an S2 plugin that allows XML-free (mostly) configuration 
and can sometimes affect the way things work--it's just one of the information 
points that can be handy.

Another thing I'll often try is running it with the default stack to see if the 
error persists. Time permitting I or someone else will take the fragments 
presented and do a quick sanity check; I didn't see anything immediately 
obvious, but I don't always see stuff just looking at stuff, either :)

Dave


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



Re: Validation Help?

2008-10-15 Thread David C. Hicks

Hey Dave,

Sorry - I didn't mean to be deliberately vague.  I'm kind of stumbling 
through this to help the team.  The real Struts "genius" of the bunch is 
wrapped up with other problems.  I was just trying to help.


If by "zero-config" you're referring to our network, that would be No.  
We're on a fairly standard DHCP/DNS local network here at the office.  
If you mean something else, then I'm afraid I'm blonde again.  :-)


I think I tried setting up a CustomerController-add-validation.xml, but 
I'll give it another try. 


Thanks for the feedback,
Dave


Dave Newton wrote:

--- On Wed, 10/15/08, David C. Hicks wrote:
  
We are using the "simple" theme primarily, but even if the page won't 
report errors shouldn't the action fail if it is validating and I give 
it bad data on purpose?



Yes, but you never actually said specifically what was or wasn't happening, so 
I had to guess.

  
Our main layout has a  tag that should get 
any reported validation, though.



Didn't know that either.

  

We're just not relying on the theme to insert that tag for us.



None of the default shipping themes would; the themes that show error messages 
put the messages inline with the form fields.

The first thing I'd try is creating a XxxController-add-validation.xml and see 
if that works, since you've defined an alias for the action class. (Where Xxx 
is whatever that controller class was called.)

Are you using zero-config?

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 Help?

2008-10-15 Thread Dave Newton
--- On Wed, 10/15/08, David C. Hicks wrote:
> We are using the "simple" theme primarily, but even if the page won't 
> report errors shouldn't the action fail if it is validating and I give 
> it bad data on purpose?

Yes, but you never actually said specifically what was or wasn't happening, so 
I had to guess.

> Our main layout has a  tag that should get 
> any reported validation, though.

Didn't know that either.

> We're just not relying on the theme to insert that tag for us.

None of the default shipping themes would; the themes that show error messages 
put the messages inline with the form fields.

The first thing I'd try is creating a XxxController-add-validation.xml and see 
if that works, since you've defined an alias for the action class. (Where Xxx 
is whatever that controller class was called.)

Are you using zero-config?

Dave


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



Re: Validation Help?

2008-10-15 Thread David C. Hicks
We are using the "simple" theme primarily, but even if the page won't 
report errors shouldn't the action fail if it is validating and I give 
it bad data on purpose? We believe it's simply not executing the 
validation. Our main layout has a  tag that should get 
any reported validation, though. We're just not relying on the theme to 
insert that tag for us.


Dave Newton wrote:

What theme are you using? The presence of a bunch of table-oriented tags would lead me to 
believe you're using the "simple" theme, which doesn't report validation errors.

  



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



Re: Validation Help?

2008-10-15 Thread Dave Newton
What theme are you using? The presence of a bunch of table-oriented tags would 
lead me to believe you're using the "simple" theme, which doesn't report 
validation errors.


--- On Wed, 10/15/08, David C. Hicks <[EMAIL PROTECTED]> wrote:

> From: David C. Hicks <[EMAIL PROTECTED]>
> Subject: Re: Validation Help?
> To: "Struts Users Mailing List" 
> Date: Wednesday, October 15, 2008, 5:42 PM
> We are not overriding the validate() method of
> ActionSupport. I 
> double-checked to be sure of that.
> 
> CustomerController (is an extension of a couple of base
> classes but 
> eventually extends ActionSupport):
> public class CustomerController extends
> AbstractCrudController {
> private static final long serialVersionUID = 1L;
> 
> public CustomerController(GenericDao
> dao) {
> super(Customer.class, dao);
> }
> 
> public List getCustomers() {
> return getPersistentEntityList();
> }
> 
> public Customer getCustomer() {
> return getPersistentEntity();
> }
> 
> public void setCustomer(Customer customer) {
> setPersistentEntity(customer);
> }
> 
> @Override
> protected void performPreCreateOperations() {
> }
> 
> @Override
> protected boolean performPreAddOperations() {
> return true;
> }
> 
> @Override
> protected void performPreUpdateOperations() {
> }
> 
> @Override
> protected void performPrepareOperations() {
> }
> 
> @Override
> protected Privilege crudPrivilege() {
> return Privilege.CRUD_CUSTOMER;
> }
> }
> 
> Customer action configuration:
> 
>  namespace="/customer"
> extends="harvey">
>  class="customerController">
>  type="tiles">customer.list
> 
>  class="customerController">
>  type="tiles">customer.view
> 
>  method="create"
> class="customerController">
>  type="tiles">customer.create
> 
>  class="customerController">
>  type="redirectAction">list
>  type="tiles">customer.create
> 
>  class="customerController">
>  type="tiles">customer.edit
> 
>  method="update"
> class="customerController">
>  type="redirectAction">list
>  type="tiles">customer.edit
> 
>  method="delete"
> class="customerController">
>  type="redirectAction">list
> 
> 
> 
> 
> Customer validation configuration:
> 
> 
> 
> 
> You must enter a value for Customer
> Name.
> 
> 
> 4
> Customer name must be at least ${min}
> characters long.
> 
> 
> 20
> Customer name may not be longer than ${max}
> characters.
> 
> 
> 
> 
> Customer Create JSP:
> <%@ taglib prefix="s"
> uri="/struts-tags"%>
> <%@ taglib prefix="tiles"
> uri="http://tiles.apache.org/tags-tiles"%>
> 
> Create Customer
>  action="add" validate="false"
> method="POST">
> 
> 
> 
> 
> And here is the form.jsp that provides the fields for this
> form:
> <%@ taglib prefix="s"
> uri="/struts-tags"%>
> 
> 
> 
> 
> 
>  for="description">Name:
> 
> 
>  name="customer.name"/>
> 
> 
> 
> 
>  class="button">
> 
> 
> 
> 
> 
> 
> Dave Newton wrote:
> > --- On Wed, 10/15/08, David C. Hicks wrote:
> >   
> >> I can't really tell if validation is even
> being called.
> >> If by "is workflow" you mean is it in
> the interceptor stack,
> >> Yes. It is  in the stack immediately following
> validation.
> >>
> >> I'll be happy to provide whatever information
> you need.
> >> I would be considered a "newbie". So,
> I'm not really
> >> sure what information is helpful.
> >> 
> >
> > The code (if applicable, like are you defining your
> own validate()), configuration (action, validation), and
> possibly the JSP (showing things like the action being
> submitted to, and an example field for which validation is
> failing). And the version of Struts 2.
> >
> > 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]

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



Re: Validation Help?

2008-10-15 Thread David C. Hicks
Oh geez. All of the indentation got waxed when I sent this. Sorry about 
that. It looked a lot neater when I composed it.


David C. Hicks wrote:
We are not overriding the validate() method of ActionSupport. I 
double-checked to be sure of that.


CustomerController (is an extension of a couple of base classes but 
eventually extends ActionSupport):
public class CustomerController extends 
AbstractCrudController {

private static final long serialVersionUID = 1L;

public CustomerController(GenericDao dao) {
super(Customer.class, dao);
}

public List getCustomers() {
return getPersistentEntityList();
}

public Customer getCustomer() {
return getPersistentEntity();
}

public void setCustomer(Customer customer) {
setPersistentEntity(customer);
}

@Override
protected void performPreCreateOperations() {
}

@Override
protected boolean performPreAddOperations() {
return true;
}

@Override
protected void performPreUpdateOperations() {
}

@Override
protected void performPrepareOperations() {
}

@Override
protected Privilege crudPrivilege() {
return Privilege.CRUD_CUSTOMER;
}
}

Customer action configuration:



customer.list


customer.view


customer.create


list
customer.create


customer.edit


list
customer.edit


list




Customer validation configuration:




You must enter a value for Customer Name.


4
Customer name must be at least ${min} characters long.


20
Customer name may not be longer than ${max} 
characters.





Customer Create JSP:
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>

Create Customer
method="POST">





And here is the form.jsp that provides the fields for this form:
<%@ taglib prefix="s" uri="/struts-tags"%>





Name:














Dave Newton wrote:

--- On Wed, 10/15/08, David C. Hicks wrote:

I can't really tell if validation is even being called.
If by "is workflow" you mean is it in the interceptor stack,
Yes. It is in the stack immediately following validation.

I'll be happy to provide whatever information you need.
I would be considered a "newbie". So, I'm not really
sure what information is helpful.


The code (if applicable, like are you defining your own validate()), 
configuration (action, validation), and possibly the JSP (showing 
things like the action being submitted to, and an example field for 
which validation is failing). And the version of Struts 2.


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]



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



Re: Validation Help?

2008-10-15 Thread David C. Hicks
We are not overriding the validate() method of ActionSupport. I 
double-checked to be sure of that.


CustomerController (is an extension of a couple of base classes but 
eventually extends ActionSupport):

public class CustomerController extends AbstractCrudController {
private static final long serialVersionUID = 1L;

public CustomerController(GenericDao dao) {
super(Customer.class, dao);
}

public List getCustomers() {
return getPersistentEntityList();
}

public Customer getCustomer() {
return getPersistentEntity();
}

public void setCustomer(Customer customer) {
setPersistentEntity(customer);
}

@Override
protected void performPreCreateOperations() {
}

@Override
protected boolean performPreAddOperations() {
return true;
}

@Override
protected void performPreUpdateOperations() {
}

@Override
protected void performPrepareOperations() {
}

@Override
protected Privilege crudPrivilege() {
return Privilege.CRUD_CUSTOMER;
}
}

Customer action configuration:



customer.list


customer.view


customer.create


list
customer.create


customer.edit


list
customer.edit


list




Customer validation configuration:




You must enter a value for Customer Name.


4
Customer name must be at least ${min} characters long.


20
Customer name may not be longer than ${max} characters.




Customer Create JSP:
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>

Create Customer





And here is the form.jsp that provides the fields for this form:
<%@ taglib prefix="s" uri="/struts-tags"%>





Name:














Dave Newton wrote:

--- On Wed, 10/15/08, David C. Hicks wrote:
  

I can't really tell if validation is even being called.
If by "is workflow" you mean is it in the interceptor stack,
Yes. It is  in the stack immediately following validation.

I'll be happy to provide whatever information you need.
I would be considered a "newbie". So, I'm not really
sure what information is helpful.



The code (if applicable, like are you defining your own validate()), 
configuration (action, validation), and possibly the JSP (showing things like 
the action being submitted to, and an example field for which validation is 
failing). And the version of Struts 2.

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 Help?

2008-10-15 Thread Dave Newton
--- On Wed, 10/15/08, David C. Hicks wrote:
> I can't really tell if validation is even being called.
> If by "is workflow" you mean is it in the interceptor stack,
> Yes. It is  in the stack immediately following validation.
> 
> I'll be happy to provide whatever information you need.
> I would be considered a "newbie". So, I'm not really
> sure what information is helpful.

The code (if applicable, like are you defining your own validate()), 
configuration (action, validation), and possibly the JSP (showing things like 
the action being submitted to, and an example field for which validation is 
failing). And the version of Struts 2.

Dave


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



Re: Validation Help?

2008-10-15 Thread David C. Hicks

I can't really tell if validation is even being called.
If by "is workflow" you mean is it in the interceptor stack, Yes. It is 
in the stack immediately following validation.


I'll be happy to provide whatever information you need. I would be 
considered a "newbie". So, I'm not really sure what information is helpful.



Dave Newton wrote:

--- On Wed, 10/15/08, David C. Hicks wrote:
  

[...] Validation is on my interceptor stack.



Is "workflow"? Do you know that *validation* doesn't occur, or that it just 
doesn't return to input on validation errors?

Without any further information it'll be tough to help.

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 Help?

2008-10-15 Thread Dave Newton
--- On Wed, 10/15/08, David C. Hicks wrote:
> [...] Validation is on my interceptor stack.

Is "workflow"? Do you know that *validation* doesn't occur, or that it just 
doesn't return to input on validation errors?

Without any further information it'll be tough to help.

Dave


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



Re: validation help

2007-02-09 Thread Niall Pemberton

I don't think you can do this without either a custom validator or as
Jim suggests, implementing it in the validate method of your form.

Niall

On 2/9/07, Jim Reynolds <[EMAIL PROTECTED]> wrote:

It appears you are probably using the ValidatorForm or
ValidatorActionForm in 1.x?
Just a thought ... could you just implement the validate method in the
Action form and handle it with logic? I did some looking, and see that
you can validate two fields against each other, but I couldn't find
anywhere to do if/else logic in the validation.xml file.

Possibly the Struts cookbook may have an example, but I don't have
that book here. Maybe someone else on the list may have that.



On 2/9/07, fea jabi <[EMAIL PROTECTED]> wrote:
> can someone help me with this please. thanks.
>
>
> >From: "fea jabi" <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" 
> >To: user@struts.apache.org
> >Subject: validation help
> >Date: Thu, 08 Feb 2007 10:01:01 -0500
> >
> >
> >
> >Have 2 radio buttons of ID and Name and an input field to enter criteria.
> >
> >
> >When the ID is selected the criteria the user entered should be numeric.
> >Should display the user with the appropriate message that only int
> >value is allowed.
> >
> >When the Name is selected the criteria the user entered
> >should be alphanumeric. Should display appropriate message that only
> >alphanumeric values are allowed.
> >
> >Tried the below it works great for the second option. Not sure how can I
> >join
> >the two conditions.
> >
> >
> >
> >
> >
> >
> >
> >   mask
> >   ${alpha_numeric}
> >
> >
> >
> >
> >
> >You help is appreciated. Thanks.
> >
> >_
> >Laugh, share and connect with Windows Live Messenger
> 
>http://clk.atdmt.com/MSN/go/msnnkwme002001msn/direct/01/?href=http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=hmtagline
> >
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> _
> Turn searches into helpful donations. Make your search count.
> 
http://click4thecause.live.com/search/charity/default.aspx?source=hmemtagline_donation&FORM=WLMTAG
>
>
> -
> 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 help

2007-02-09 Thread Jim Reynolds

It appears you are probably using the ValidatorForm or
ValidatorActionForm in 1.x?
Just a thought ... could you just implement the validate method in the
Action form and handle it with logic? I did some looking, and see that
you can validate two fields against each other, but I couldn't find
anywhere to do if/else logic in the validation.xml file.

Possibly the Struts cookbook may have an example, but I don't have
that book here. Maybe someone else on the list may have that.



On 2/9/07, fea jabi <[EMAIL PROTECTED]> wrote:

can someone help me with this please. thanks.


>From: "fea jabi" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" 
>To: user@struts.apache.org
>Subject: validation help
>Date: Thu, 08 Feb 2007 10:01:01 -0500
>
>
>
>Have 2 radio buttons of ID and Name and an input field to enter criteria.
>
>
>When the ID is selected the criteria the user entered should be numeric.
>Should display the user with the appropriate message that only int
>value is allowed.
>
>When the Name is selected the criteria the user entered
>should be alphanumeric. Should display appropriate message that only
>alphanumeric values are allowed.
>
>Tried the below it works great for the second option. Not sure how can I
>join
>the two conditions.
>
>
>
>
>
>
>
>   mask
>   ${alpha_numeric}
>
>
>
>
>
>You help is appreciated. Thanks.
>
>_
>Laugh, share and connect with Windows Live Messenger
>http://clk.atdmt.com/MSN/go/msnnkwme002001msn/direct/01/?href=http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=hmtagline
>
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>

_
Turn searches into helpful donations. Make your search count.
http://click4thecause.live.com/search/charity/default.aspx?source=hmemtagline_donation&FORM=WLMTAG


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

2007-02-09 Thread fea jabi

can someone help me with this please. thanks.



From: "fea jabi" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" 
To: user@struts.apache.org
Subject: validation help
Date: Thu, 08 Feb 2007 10:01:01 -0500



Have 2 radio buttons of ID and Name and an input field to enter criteria.


When the ID is selected the criteria the user entered should be numeric.
Should display the user with the appropriate message that only int
value is allowed.

When the Name is selected the criteria the user entered
should be alphanumeric. Should display appropriate message that only
alphanumeric values are allowed.

Tried the below it works great for the second option. Not sure how can I 
join

the two conditions.

   
   
   
   
   
   
mask
${alpha_numeric}
   
   
   
   

You help is appreciated. Thanks.

_
Laugh, share and connect with Windows Live Messenger 
http://clk.atdmt.com/MSN/go/msnnkwme002001msn/direct/01/?href=http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=hmtagline



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



_
Turn searches into helpful donations. Make your search count. 
http://click4thecause.live.com/search/charity/default.aspx?source=hmemtagline_donation&FORM=WLMTAG



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



RE: Validation help: One struts form, multiple actions

2006-05-08 Thread Paul Benedict
Are you using Struts 1.2.9? It contains EventDispatchAction
which allows your design to do both viewing of a form and processing
under one action mapping (or two, your choice).

As for the validation key, override the getValidationKey() of your
ValidatorForm or DynaValidatorForm. The string returned is the name
of the form to match in validation.xml


..


So if you're keeping track of what step you're on, you can choose
the validation to run when you execute the next action.

Paul

--- "Chaudhary, Harsh" <[EMAIL PROTECTED]> wrote:

> What do you mean when you say "custom validation key"?
> 
> I am thinking about going with action chaining to solve this particular
> one. Like have every form call an action e.g. Dispatch and then call
> different actions to go with the page a user just came from e.g. if a
> user came from clienta.jsp, a form submit calls Dispatch.do which
> forwards to an action like clientaValidation.do which runs the
> validations and then calls the next forward.
> 
> Terrible design but this is in response to a change in our codebase
> which kind of messed things up a bit.
> 
> Harsh.
> 
> -Original Message-
> From: Paul Benedict [mailto:[EMAIL PROTECTED] 
> Sent: Monday, May 08, 2006 5:27 PM
> To: Struts Users Mailing List; [EMAIL PROTECTED]
> Subject: Re: Validation help: One struts form, multiple actions
> 
> 
> Chaudhary,
> 
> You need a custom validation key for each step in the process.
> Override the form's validate() and create a key. Then you should
> modify your validation.xml to run validations just for that step.
> 
> Paul
> 
> --- "Chaudhary, Harsh" <[EMAIL PROTECTED]> wrote:
> 
> > Now that I think about it, my question is just this:
> > 
> > Is there a way to selectively validate fields in a struts form?
> > 
> > Harsh.
> > 
> > -Original Message-
> > From: Quinn Stone [mailto:[EMAIL PROTECTED] 
> > Sent: Monday, May 08, 2006 4:03 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: Validation help: One struts form, multiple actions
> > 
> > 
> > My bad. Missed that. How is it blowing out?
> > 
> > Q
> > 
> > > -Original Message-
> > > From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] 
> > > Sent: Monday, May 08, 2006 1:27 PM
> > > To: Struts Users Mailing List; [EMAIL PROTECTED]
> > > Subject: RE: Validation help: One struts form, multiple actions
> > > 
> > > 
> > > I intentionally used /ClientA for my form name as I said, I have one
> > > struts form but multiple actions using that same form. So while
> > > validating, I want to validate only the fields associated with a
> > > particular action e.g. for ClientA action, I want to validate only
> > > fields for ClientA and same for ClientB i.e. I want to validate only
> > > Client B fields for ClientB action. All the fields are using the
> same
> > > struts form.
> > > 
> > > That is why I am using a ValidatorActionForm instead of a 
> > > ValidatorForm.
> > > 
> > > Harsh.
> > > 
> > > -Original Message-
> > > From: Quinn Stone [mailto:[EMAIL PROTECTED] 
> > > Sent: Monday, May 08, 2006 3:26 PM
> > > To: 'Struts Users Mailing List'
> > > Subject: RE: Validation help: One struts form, multiple actions
> > > 
> > > 
> > > Your form name in validation.xml should be "InputDataForm" (no
> leading
> > > slash),
> > > not "/ClientA".
> > > 
> > > > -Original Message-
> > > > From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] 
> > > > Sent: Monday, May 08, 2006 1:16 PM
> > > > To: Struts Users Mailing List
> > > > Subject: Validation help: One struts form, multiple actions
> > > > 
> > > > 
> > > > Hi,
> > > > I am having some trouble with struts validation. Here's the case:
> > > > 
> > > > I have multiple actions corresponding to multiple pages.
> > > > I have only one struts form for all these actions.
> > > > 
> > > > I would appreciate it if someone could tell me how to set up my
> > > > validation. I am using ValidatorActionForm for my struts 
> > > > form. My action
> > > > class extends from Action.
> > > > 
> > > > Here's a snippet of my struts-co

RE: Validation help: One struts form, multiple actions

2006-05-08 Thread Chaudhary, Harsh
What do you mean when you say "custom validation key"?

I am thinking about going with action chaining to solve this particular
one. Like have every form call an action e.g. Dispatch and then call
different actions to go with the page a user just came from e.g. if a
user came from clienta.jsp, a form submit calls Dispatch.do which
forwards to an action like clientaValidation.do which runs the
validations and then calls the next forward.

Terrible design but this is in response to a change in our codebase
which kind of messed things up a bit.

Harsh.

-Original Message-
From: Paul Benedict [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 08, 2006 5:27 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: Re: Validation help: One struts form, multiple actions


Chaudhary,

You need a custom validation key for each step in the process.
Override the form's validate() and create a key. Then you should
modify your validation.xml to run validations just for that step.

Paul

--- "Chaudhary, Harsh" <[EMAIL PROTECTED]> wrote:

> Now that I think about it, my question is just this:
> 
> Is there a way to selectively validate fields in a struts form?
> 
> Harsh.
> 
> -Original Message-
> From: Quinn Stone [mailto:[EMAIL PROTECTED] 
> Sent: Monday, May 08, 2006 4:03 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Validation help: One struts form, multiple actions
> 
> 
> My bad. Missed that. How is it blowing out?
> 
> Q
> 
> > -Original Message-
> > From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] 
> > Sent: Monday, May 08, 2006 1:27 PM
> > To: Struts Users Mailing List; [EMAIL PROTECTED]
> > Subject: RE: Validation help: One struts form, multiple actions
> > 
> > 
> > I intentionally used /ClientA for my form name as I said, I have one
> > struts form but multiple actions using that same form. So while
> > validating, I want to validate only the fields associated with a
> > particular action e.g. for ClientA action, I want to validate only
> > fields for ClientA and same for ClientB i.e. I want to validate only
> > Client B fields for ClientB action. All the fields are using the
same
> > struts form.
> > 
> > That is why I am using a ValidatorActionForm instead of a 
> > ValidatorForm.
> > 
> > Harsh.
> > 
> > -Original Message-
> > From: Quinn Stone [mailto:[EMAIL PROTECTED] 
> > Sent: Monday, May 08, 2006 3:26 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: Validation help: One struts form, multiple actions
> > 
> > 
> > Your form name in validation.xml should be "InputDataForm" (no
leading
> > slash),
> > not "/ClientA".
> > 
> > > -Original Message-
> > > From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] 
> > > Sent: Monday, May 08, 2006 1:16 PM
> > > To: Struts Users Mailing List
> > > Subject: Validation help: One struts form, multiple actions
> > > 
> > > 
> > > Hi,
> > > I am having some trouble with struts validation. Here's the case:
> > > 
> > > I have multiple actions corresponding to multiple pages.
> > > I have only one struts form for all these actions.
> > > 
> > > I would appreciate it if someone could tell me how to set up my
> > > validation. I am using ValidatorActionForm for my struts 
> > > form. My action
> > > class extends from Action.
> > > 
> > > Here's a snippet of my struts-config.xml:
> > > 
> > >> >   
> > > type="xxx.xxx.presentation.struts.action.ClientaAction" 
> > >   name="InputDataForm"  
> > >   scope="request" 
> > >   validate="true"
> > >   input=".app.clienta">
> > > 
> > >   
> > > 
> > >> >   
> > > type="xxx.xxx.presentation.struts.action.ClientbAction" 
> > //This is diff
> > > from "/ClientA" type
> > >   name="InputDataForm"  
> > >   scope="request" 
> > >   validate="true"
> > >   input=".app.clientb">
> > > 
> > >   
> > > 
> > > Snippet from my validation.xml:
> > > 
> > > 
> > > 
> > > 
> > >   
> > > 
> > > 
> > > 
> > >   

Re: Validation help: One struts form, multiple actions

2006-05-08 Thread Paul Benedict
Chaudhary,

You need a custom validation key for each step in the process.
Override the form's validate() and create a key. Then you should
modify your validation.xml to run validations just for that step.

Paul

--- "Chaudhary, Harsh" <[EMAIL PROTECTED]> wrote:

> Now that I think about it, my question is just this:
> 
> Is there a way to selectively validate fields in a struts form?
> 
> Harsh.
> 
> -Original Message-
> From: Quinn Stone [mailto:[EMAIL PROTECTED] 
> Sent: Monday, May 08, 2006 4:03 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Validation help: One struts form, multiple actions
> 
> 
> My bad. Missed that. How is it blowing out?
> 
> Q
> 
> > -Original Message-
> > From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] 
> > Sent: Monday, May 08, 2006 1:27 PM
> > To: Struts Users Mailing List; [EMAIL PROTECTED]
> > Subject: RE: Validation help: One struts form, multiple actions
> > 
> > 
> > I intentionally used /ClientA for my form name as I said, I have one
> > struts form but multiple actions using that same form. So while
> > validating, I want to validate only the fields associated with a
> > particular action e.g. for ClientA action, I want to validate only
> > fields for ClientA and same for ClientB i.e. I want to validate only
> > Client B fields for ClientB action. All the fields are using the same
> > struts form.
> > 
> > That is why I am using a ValidatorActionForm instead of a 
> > ValidatorForm.
> > 
> > Harsh.
> > 
> > -Original Message-
> > From: Quinn Stone [mailto:[EMAIL PROTECTED] 
> > Sent: Monday, May 08, 2006 3:26 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: Validation help: One struts form, multiple actions
> > 
> > 
> > Your form name in validation.xml should be "InputDataForm" (no leading
> > slash),
> > not "/ClientA".
> > 
> > > -Original Message-
> > > From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] 
> > > Sent: Monday, May 08, 2006 1:16 PM
> > > To: Struts Users Mailing List
> > > Subject: Validation help: One struts form, multiple actions
> > > 
> > > 
> > > Hi,
> > > I am having some trouble with struts validation. Here's the case:
> > > 
> > > I have multiple actions corresponding to multiple pages.
> > > I have only one struts form for all these actions.
> > > 
> > > I would appreciate it if someone could tell me how to set up my
> > > validation. I am using ValidatorActionForm for my struts 
> > > form. My action
> > > class extends from Action.
> > > 
> > > Here's a snippet of my struts-config.xml:
> > > 
> > >> >   
> > > type="xxx.xxx.presentation.struts.action.ClientaAction" 
> > >   name="InputDataForm"  
> > >   scope="request" 
> > >   validate="true"
> > >   input=".app.clienta">
> > > 
> > >   
> > > 
> > >> >   
> > > type="xxx.xxx.presentation.struts.action.ClientbAction" 
> > //This is diff
> > > from "/ClientA" type
> > >   name="InputDataForm"  
> > >   scope="request" 
> > >   validate="true"
> > >   input=".app.clientb">
> > > 
> > >   
> > > 
> > > Snippet from my validation.xml:
> > > 
> > > 
> > > 
> > > 
> > >   
> > > 
> > > 
> > > 
> > >   mask
> > >   ${nameMask}
> > > 
> > >   
> > >   
> > > 
> > > 
> > > 
> > > I thought this should be straight forward, i.e., associate your
> > > validation formName to actions and set validate to true in
> > > struts-config.xml. But, its blowing out. Any ideas?
> > > 
> > > Thanks,
> > > Harsh.
> > > 
> > > 
> > -
> > > 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]
> > 
> 
> 
> -
> 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]
> 
> 


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

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



Re: Validation help: One struts form, multiple actions

2006-05-08 Thread Dave Newton
Chaudhary, Harsh wrote:
> Now that I think about it, my question is just this:
>
> Is there a way to selectively validate fields in a struts form?
>   

Yes, only put the fields you want into the validation rule.

>>> 
>>> 
>>>
>>>   
>>> 
>>> 
>>> 
>>>   mask
>>>   ${nameMask}
>>> 
>>>   
>>>   
>>>
>>> 
>>>   

Create another form with the name attribute set to the action of the
other place the form-bean is used. So

What you _mean_ to be asking is if I visit an action and don't want the
validation to run until the person _submits_ from that action, which was
the discussion of a minor thread late last week.

Personally, I _never_ use automatic validation and I _always_ submit
with a POST. This makes it trivial to divide my actions up into GET and
POST handlers. I only call validation on POSTs.

A few other options were also discussed.

Dave



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



RE: Validation help: One struts form, multiple actions

2006-05-08 Thread Chaudhary, Harsh
I have the action ClientA which is associated with e.g. clienta.jsp .
Action ClientA is also used in the validation.xml like:
 
 
 
   
 
 
 
   mask
   ${nameMask}
 
   
   
 
 

Here's my code again for my struts-config.xml:


 


The problem is that this validation runs when action ClientA is called.
I want this validation to be called when a user is navigating away from
the clienta.jsp, not when a user is coming to clienta.jsp by calling the
action ClientA.

It blows up in the sense that when I navigate away from clienta.jsp
using any other action, and considering that there are error in the
clienta.jsp page, it navigates away fine. But when I navigate back to
clienta.jsp from some other page, by calling the action ClientA,
validation runs and displays an error.

My question would be:

Is there a way in struts to partially validate the fields of a struts
form?


I hope I was clear in my explanation.

Harsh.


-Original Message-
From: Quinn Stone [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 08, 2006 4:03 PM
To: 'Struts Users Mailing List'
Subject: RE: Validation help: One struts form, multiple actions


My bad. Missed that. How is it blowing out?

Q

> -Original Message-
> From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] 
> Sent: Monday, May 08, 2006 1:27 PM
> To: Struts Users Mailing List; [EMAIL PROTECTED]
> Subject: RE: Validation help: One struts form, multiple actions
> 
> 
> I intentionally used /ClientA for my form name as I said, I have one
> struts form but multiple actions using that same form. So while
> validating, I want to validate only the fields associated with a
> particular action e.g. for ClientA action, I want to validate only
> fields for ClientA and same for ClientB i.e. I want to validate only
> Client B fields for ClientB action. All the fields are using the same
> struts form.
> 
> That is why I am using a ValidatorActionForm instead of a 
> ValidatorForm.
> 
> Harsh.
> 
> -Original Message-
> From: Quinn Stone [mailto:[EMAIL PROTECTED] 
> Sent: Monday, May 08, 2006 3:26 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Validation help: One struts form, multiple actions
> 
> 
> Your form name in validation.xml should be "InputDataForm" (no leading
> slash),
> not "/ClientA".
> 
> > -Original Message-
> > From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] 
> > Sent: Monday, May 08, 2006 1:16 PM
> > To: Struts Users Mailing List
> > Subject: Validation help: One struts form, multiple actions
> > 
> > 
> > Hi,
> > I am having some trouble with struts validation. Here's the case:
> > 
> > I have multiple actions corresponding to multiple pages.
> > I have only one struts form for all these actions.
> > 
> > I would appreciate it if someone could tell me how to set up my
> > validation. I am using ValidatorActionForm for my struts 
> > form. My action
> > class extends from Action.
> > 
> > Here's a snippet of my struts-config.xml:
> > 
> >  > 
> > type="xxx.xxx.presentation.struts.action.ClientaAction" 
> > name="InputDataForm"  
> > scope="request" 
> > validate="true"
> > input=".app.clienta">
> > 
> > 
> > 
> >  > 
> > type="xxx.xxx.presentation.struts.action.ClientbAction" 
> //This is diff
> > from "/ClientA" type
> > name="InputDataForm"  
> > scope="request" 
> > validate="true"
> > input=".app.clientb">
> > 
> > 
> > 
> > Snippet from my validation.xml:
> > 
> > 
> > 
> > 
> >   
> > 
> > 
> > 
> >   mask
> >   ${nameMask}
> > 
> >   
> >   
> > 
> > 
> > 
> > I thought this should be straight forward, i.e., associate your
> > validation formName to actions and set validate to true in
> > struts-config.xml. But, its blowing out. Any ideas?
> > 
> > Thanks,
> > Harsh.
> > 
> > 
> -
> > 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]
> 


-
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 help: One struts form, multiple actions

2006-05-08 Thread Quinn Stone
My bad. Missed that. How is it blowing out?

Q

> -Original Message-
> From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] 
> Sent: Monday, May 08, 2006 1:27 PM
> To: Struts Users Mailing List; [EMAIL PROTECTED]
> Subject: RE: Validation help: One struts form, multiple actions
> 
> 
> I intentionally used /ClientA for my form name as I said, I have one
> struts form but multiple actions using that same form. So while
> validating, I want to validate only the fields associated with a
> particular action e.g. for ClientA action, I want to validate only
> fields for ClientA and same for ClientB i.e. I want to validate only
> Client B fields for ClientB action. All the fields are using the same
> struts form.
> 
> That is why I am using a ValidatorActionForm instead of a 
> ValidatorForm.
> 
> Harsh.
> 
> -Original Message-
> From: Quinn Stone [mailto:[EMAIL PROTECTED] 
> Sent: Monday, May 08, 2006 3:26 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Validation help: One struts form, multiple actions
> 
> 
> Your form name in validation.xml should be "InputDataForm" (no leading
> slash),
> not "/ClientA".
> 
> > -Original Message-
> > From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] 
> > Sent: Monday, May 08, 2006 1:16 PM
> > To: Struts Users Mailing List
> > Subject: Validation help: One struts form, multiple actions
> > 
> > 
> > Hi,
> > I am having some trouble with struts validation. Here's the case:
> > 
> > I have multiple actions corresponding to multiple pages.
> > I have only one struts form for all these actions.
> > 
> > I would appreciate it if someone could tell me how to set up my
> > validation. I am using ValidatorActionForm for my struts 
> > form. My action
> > class extends from Action.
> > 
> > Here's a snippet of my struts-config.xml:
> > 
> >  > 
> > type="xxx.xxx.presentation.struts.action.ClientaAction" 
> > name="InputDataForm"  
> > scope="request" 
> > validate="true"
> > input=".app.clienta">
> > 
> > 
> > 
> >  > 
> > type="xxx.xxx.presentation.struts.action.ClientbAction" 
> //This is diff
> > from "/ClientA" type
> > name="InputDataForm"  
> > scope="request" 
> > validate="true"
> > input=".app.clientb">
> > 
> > 
> > 
> > Snippet from my validation.xml:
> > 
> > 
> > 
> > 
> >   
> > 
> > 
> > 
> >   mask
> >   ${nameMask}
> > 
> >   
> >   
> > 
> > 
> > 
> > I thought this should be straight forward, i.e., associate your
> > validation formName to actions and set validate to true in
> > struts-config.xml. But, its blowing out. Any ideas?
> > 
> > Thanks,
> > Harsh.
> > 
> > 
> -
> > 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]
> 


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



RE: Validation help: One struts form, multiple actions

2006-05-08 Thread Chaudhary, Harsh
I intentionally used /ClientA for my form name as I said, I have one
struts form but multiple actions using that same form. So while
validating, I want to validate only the fields associated with a
particular action e.g. for ClientA action, I want to validate only
fields for ClientA and same for ClientB i.e. I want to validate only
Client B fields for ClientB action. All the fields are using the same
struts form.

That is why I am using a ValidatorActionForm instead of a ValidatorForm.

Harsh.

-Original Message-
From: Quinn Stone [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 08, 2006 3:26 PM
To: 'Struts Users Mailing List'
Subject: RE: Validation help: One struts form, multiple actions


Your form name in validation.xml should be "InputDataForm" (no leading
slash),
not "/ClientA".

> -Original Message-
> From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] 
> Sent: Monday, May 08, 2006 1:16 PM
> To: Struts Users Mailing List
> Subject: Validation help: One struts form, multiple actions
> 
> 
> Hi,
> I am having some trouble with struts validation. Here's the case:
> 
> I have multiple actions corresponding to multiple pages.
> I have only one struts form for all these actions.
> 
> I would appreciate it if someone could tell me how to set up my
> validation. I am using ValidatorActionForm for my struts 
> form. My action
> class extends from Action.
> 
> Here's a snippet of my struts-config.xml:
> 
>  
> type="xxx.xxx.presentation.struts.action.ClientaAction" 
>   name="InputDataForm"  
>   scope="request" 
>   validate="true"
>   input=".app.clienta">
> 
>   
> 
>  
> type="xxx.xxx.presentation.struts.action.ClientbAction" //This is diff
> from "/ClientA" type
>   name="InputDataForm"  
>   scope="request" 
>   validate="true"
>   input=".app.clientb">
> 
>   
> 
> Snippet from my validation.xml:
> 
> 
> 
> 
>   
> 
> 
> 
>   mask
>   ${nameMask}
> 
>   
>   
> 
> 
> 
> I thought this should be straight forward, i.e., associate your
> validation formName to actions and set validate to true in
> struts-config.xml. But, its blowing out. Any ideas?
> 
> Thanks,
> Harsh.
> 
> -
> 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 help: One struts form, multiple actions

2006-05-08 Thread Quinn Stone
Your form name in validation.xml should be "InputDataForm" (no leading slash),
not "/ClientA".

> -Original Message-
> From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] 
> Sent: Monday, May 08, 2006 1:16 PM
> To: Struts Users Mailing List
> Subject: Validation help: One struts form, multiple actions
> 
> 
> Hi,
> I am having some trouble with struts validation. Here's the case:
> 
> I have multiple actions corresponding to multiple pages.
> I have only one struts form for all these actions.
> 
> I would appreciate it if someone could tell me how to set up my
> validation. I am using ValidatorActionForm for my struts 
> form. My action
> class extends from Action.
> 
> Here's a snippet of my struts-config.xml:
> 
>  
> type="xxx.xxx.presentation.struts.action.ClientaAction" 
>   name="InputDataForm"  
>   scope="request" 
>   validate="true"
>   input=".app.clienta">
> 
>   
> 
>  
> type="xxx.xxx.presentation.struts.action.ClientbAction" //This is diff
> from "/ClientA" type
>   name="InputDataForm"  
>   scope="request" 
>   validate="true"
>   input=".app.clientb">
> 
>   
> 
> Snippet from my validation.xml:
> 
> 
> 
> 
>   
> 
> 
> 
>   mask
>   ${nameMask}
> 
>   
>   
> 
> 
> 
> I thought this should be straight forward, i.e., associate your
> validation formName to actions and set validate to true in
> struts-config.xml. But, its blowing out. Any ideas?
> 
> Thanks,
> Harsh.
> 
> -
> 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 help required

2006-04-24 Thread Chaudhary, Harsh
The fact that you are getting 2 messages makes sense as you are running
validation against both the fields. It does not matter if the arg key is
the same. That would just pick the same message from your properties
file twice.

You could try using the validWhen validator and accociating that
validation with only one of the fields. Also, instead of using an arg
element in validator.xml, use an msg element to specify whatever message
you want to specify.

Or you could write your own validator, which is a bit much in this case.
I have pretty much the same thing at work here and I just use validWhen.

Harsh.

-Original Message-
From: Dinesh Mehra [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 24, 2006 1:47 PM
To: user@struts.apache.org
Subject: Validation help required


Hi,

I am using struts 1.1

I have two textboxes (username, password).
My requirements is
- I need to display a standard error message when both the fields are
empty
or when either of the field is empty.
- I need to display a different error message when both the the fields
are
filled but username-pwd do not match.

In validation.xml I declared two field properties each for username and
password with the same msg key but the problem is that when the form is
submitted with both the fields empty then the same error msg appears
twice.
How to rectify this situation.

Any kind of help would be highly appreciated.

Thanks.
Dinesh

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



Re: Validation help required

2006-04-24 Thread Srinivas Jadcharla
Use Validate method instead Validator framework



On 4/24/06, Dinesh Mehra <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I am using struts 1.1
>
> I have two textboxes (username, password).
> My requirements is
> - I need to display a standard error message when both the fields are
> empty
> or when either of the field is empty.
> - I need to display a different error message when both the the fields are
> filled but username-pwd do not match.
>
> In validation.xml I declared two field properties each for username and
> password with the same msg key but the problem is that when the form is
> submitted with both the fields empty then the same error msg appears
> twice.
> How to rectify this situation.
>
> Any kind of help would be highly appreciated.
>
> Thanks.
> Dinesh
>
>


--
Thanks & Regards
Srinivas
732-648-9421(Cell)


Re: Validation Help

2005-07-23 Thread Rafael Taboada
A good book about Struts and Validator framework is Jakarta Struts Live - 
Rick Hightower
 U can get it in www.theserverside.com 


-- 
Rafael Taboada
Software Engineer

Cell : +511-97753290

"No creo en el destino pues no me gusta tener la idea de controlar mi vida"


Re: Validation Help

2005-07-23 Thread Rafael Taboada
the properties file is that u r using right now... I mean u can use it in 
order to call value keys.


-- 
Rafael Taboada
Software Engineer

Cell : +511-97753290

"No creo en el destino pues no me gusta tener la idea de controlar mi vida"


Re: Validation Help

2005-07-23 Thread Paul Goepfert
I have a question.  I have decided to use the vaildation framework to do 
the validation in my web app.  I have created a validation.xml file, and 
a vaildator-rules.xml file.  I noticed in books about struts that I have 
there is a properties file associated with the vaildation.   Am I right? 
If so I add it to my struts-config file, right?  


-Paul
Glen Mazza wrote:

http://www.objectsource.com/Struts_Survival_ Guide.pdf, Chapter 5.
Paul Goepfert wrote:
I have created a web app using struts and velocity.  I am going to 
add vaildation on the struts end of the app.  I am still learning 
struts.  The only thing I have been able to do is use struts to move 
between pages by way of buttons.Now I want to add validation to 
my web app.  I have  no  idea how to do it.


If anyone can help me out that would be great.

-Paul

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

2005-07-20 Thread Glen Mazza

http://www.objectsource.com/Struts_Survival_Guide.pdf, Chapter 5.

Paul Goepfert wrote:
I have created a web app using struts and velocity.  I am going to add 
vaildation on the struts end of the app.  I am still learning struts.  
The only thing I have been able to do is use struts to move between 
pages by way of buttons.Now I want to add validation to my web app.  
I have  no  idea how to do it.


If anyone can help me out that would be great.

-Paul

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

2005-07-19 Thread Laurie Harper

Paul Goepfert wrote:
I have created a web app using struts and velocity.  I am going to add 
vaildation on the struts end of the app.  I am still learning struts.  
The only thing I have been able to do is use struts to move between 
pages by way of buttons.Now I want to add validation to my web app.  
I have  no  idea how to do it.


If anyone can help me out that would be great.


I'd suggest looking at Struts Validator [1] as a starting point. If that 
doesn't meet your needs, I'm sure other suggestions will follow ;-)


[1] http://struts.apache.org/userGuide/dev_validator.html

L.
--
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 Help On Large Dynamic List

2005-06-07 Thread gdeschen
This may help you:
http://wiki.apache.org/struts/StrutsCatalogLazyList
http://www.developer.com/java/ejb/article.php/3321521
http://www.developer.com/java/ejb/article.php/2233591

- Glenn




"Scott Purcell" <[EMAIL PROTECTED]> 
07/06/2005 09:19 AM
Please respond to
"Struts Users Mailing List" 


To

cc

Subject
Validation Help On Large Dynamic List






Hello,

I am using the struts framework for a project, and I am seeking advice on 
the following situation. To preface where I am, we have used server side 
validation (validation.xml) throughout the full project and all is good. I 
understand simple field validation and the attributes of the 
validation.xml file.

But as with any project, here is my problem: I have a database query that 
returns hundreds of records. The way this works, is we display the user 
list of keys, and defualt values, and they can change the values to their 
liking. 

eg:
Field1 (then in a textfield they get something like [field 1 default 
value]
Field2 [field2 default value]
and so on and so on.

Here is how the actual code looks on the page.
Now what my original page builder did, was take the value and also placed 
it in a hidden field for some type of database update later on. Hope this 
makes sense .

Agricultural Implements  


Agricultural Tractors 


Re: Validation Help On Large Dynamic List

2005-06-07 Thread Xinsheng \[mike\] Huang
use dynamic form with dynamic array inside.

Scott Purcell <[EMAIL PROTECTED]> wrote:Hello,

I am using the struts framework for a project, and I am seeking advice on the 
following situation. To preface where I am, we have used server side validation 
(validation.xml) throughout the full project and all is good. I understand 
simple field validation and the attributes of the validation.xml file.

But as with any project, here is my problem: I have a database query that 
returns hundreds of records. The way this works, is we display the user list of 
keys, and defualt values, and they can change the values to their liking. 

eg:
Field1 (then in a textfield they get something like [field 1 default value]
Field2 [field2 default value]
and so on and so on.

Here is how the actual code looks on the page.
Now what my original page builder did, was take the value and also placed it in 
a hidden field for some type of database update later on. Hope this makes sense 
.

Agricultural Implements  [input] 
 [input] 

Agricultural Tractors  [input] 
 [input] 

But what is occuring is sometimes they remove the value and then there is no 
value. And I would like to validate this.
So my question is as follows:
If I have a database query with a lot of records that have rows like so:
key1 val1
key2 val2
key3 val3

How can I validate this for " name=origGprID751499 value?

I have been reading about indexed validation but do not seem to have a handle 
on it.

Can anyone give some assistance, or ideas? I did not want to do this in simple 
javascript, as the rest of the site is all server side with Messages.


Thanks
Scott

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





Xinsheng [Mike] Huang
SCJP -- Sun Certified Programmer for Java 2 Platform
SCJD -- Sun Certified Developer for Java 2 Platform
SCEA -- Sun Certified Enterprise Architect for J2EE

410-790-7462(C)

 


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

Re: [validation] Help with 'contains' validation

2005-03-01 Thread Erik Weber
To ignore case, just convert the two Strings to uppercase before you 
test if one contains the other.

Hope I'm understanding the problem correctly . . .
Erik
Erik Weber wrote:
This is untested (!), but adapted from a working "twofields" 
validation method (used to make sure password1 matches password2, 
etc.), so it shouldn't be far off the mark.

validation.xml:
  
 
   
   
   
   
   
 minlength
 3
   
   
 maxlength
 20
   
 

 
 
   
   

   
 fieldToTest
 userID
   
 

validator-rules.xml:
   
   
 classname="ValidationUtil"
method="validateDoesNotContainUserID"
  methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
   depends="required"
   msg="errors.mustNotContainUserID"/>


ValidationUtil (classname and method specified in validator-rules.xml)
 public static boolean validateDoesNotContainUserID(Object bean, 
ValidatorAction va, Field field, ActionErrors errors, 
HttpServletRequest request) {
   String value = ValidatorUtil.getValueAsString(bean, 
field.getProperty());//value of password field
   String sProperty2 = field.getVarValue("fieldToTest");
   String value2 = ValidatorUtil.getValueAsString(bean, 
sProperty2);//value of field specified by "fieldToTest" -- userID
   if (!GenericValidator.isBlankOrNull(value)) {
 try {
   if (value.indexOf(value2) != -1) {
 errors.add(field.getKey(), Resources.getActionError(request, 
va, field));
 return false;
   }
 } catch (Exception e) {
   errors.add(field.getKey(), Resources.getActionError(request, 
va, field));
   return false;
 }
   }
   return true;
 }


Erik

Wendy Smoak wrote:
(No luck on commons-user; trying again here.)
I'm trying to validate a password such that it cannot contain the 
userId.
Is this something I can do in validation.xml?

I'm currently using a mask in validation.xml:

   
   
  mask
  ^[0-9a-zA-Z!%*-_+=:,\./?]*$
   
  
(And I'm not very good at regular expressions, so if there's a better 
way to
say "letter, digit, or any of these special characters, I would 
appreciate a
suggestion.)

Can it be done with validwhen?  How do I say "does not _contain_ 
userId"?
I'd like it to be case insensitive, but could live without that if it's
easier.

Thanks,
Wendy Smoak
-
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] Help with 'contains' validation

2005-03-01 Thread Erik Weber
This is untested (!), but adapted from a working "twofields" validation 
method (used to make sure password1 matches password2, etc.), so it 
shouldn't be far off the mark.

validation.xml:
  
 
   
   
   
   
   
 minlength
 3
   
   
 maxlength
 20
   
 

 
 
   
   

   
 fieldToTest
 userID
   
 

validator-rules.xml:
   
   
 classname="ValidationUtil"
method="validateDoesNotContainUserID"
  methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest"
   depends="required"
   msg="errors.mustNotContainUserID"/>


ValidationUtil (classname and method specified in validator-rules.xml)
 public static boolean validateDoesNotContainUserID(Object bean, 
ValidatorAction va, Field field, ActionErrors errors, HttpServletRequest 
request) {
   String value = ValidatorUtil.getValueAsString(bean, 
field.getProperty());//value of password field
   String sProperty2 = field.getVarValue("fieldToTest");
   String value2 = ValidatorUtil.getValueAsString(bean, 
sProperty2);//value of field specified by "fieldToTest" -- userID
   if (!GenericValidator.isBlankOrNull(value)) {
 try {
   if (value.indexOf(value2) != -1) {
 errors.add(field.getKey(), Resources.getActionError(request, 
va, field));
 return false;
   }
 } catch (Exception e) {
   errors.add(field.getKey(), Resources.getActionError(request, va, 
field));
   return false;
 }
   }
   return true;
 }


Erik

Wendy Smoak wrote:
(No luck on commons-user; trying again here.)
I'm trying to validate a password such that it cannot contain the userId.
Is this something I can do in validation.xml?
I'm currently using a mask in validation.xml:

   
   
  mask
  ^[0-9a-zA-Z!%*-_+=:,\./?]*$
   
  
(And I'm not very good at regular expressions, so if there's a better way to
say "letter, digit, or any of these special characters, I would appreciate a
suggestion.)
Can it be done with validwhen?  How do I say "does not _contain_ userId"?
I'd like it to be case insensitive, but could live without that if it's
easier.
Thanks,
Wendy Smoak
-
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]