You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Priya Jotwani <Pr...@infosys.com> on 2004/09/29 15:25:19 UTC

Error Handling in Struts

Hi,

 

I have a JSP Page which has two dropdown fields. If the user selects
something from first dropdown and doesn't selects anything from the
second dropdown, it displays me an error message saying "This field is
required". But now I have a scenario wherein, on selecting a particular
value from first dropdown should not force the user to select something
from the second dropdown (i.e he should be able to proceed even if he
doesn't selects anything from the second dropdown). How can I implement
this is Struts ?

 

TIA,

Priya

 


Re: Error Handling in Struts

Posted by Kranti Parisa <kr...@gmail.com>.
Priya,

onclick of the button u r getting the error na..
 
just have alook in the struts-config file that which action class is
calling while u r clicking that button.. go to that class and find out
the
if condition loop where that validation is placed...
 
i think there is some code .. which is checking the value is null or not...
 
so just remove that.. it will do..



On Wed, 29 Sep 2004 10:16:05 -0400, James Mitchell <jm...@apache.org> wrote:
> Depending on which version of Struts you are using, use requiredif or
> validwhen.
> 
> See the online documentation for further details.
> 
> http://struts.apache.org/userGuide/dev_validator.html
> 
> --
> James Mitchell
> Software Engineer / Open Source Evangelist
> EdgeTech, Inc.
> 678.910.8017
> AIM: jmitchtx
> 
> 
> 
> ----- Original Message -----
> From: "Priya Jotwani" <Pr...@infosys.com>
> To: "Struts Users Mailing List" <us...@struts.apache.org>
> Sent: Wednesday, September 29, 2004 9:25 AM
> Subject: Error Handling in Struts
> 
> Hi,
> 
> I have a JSP Page which has two dropdown fields. If the user selects
> something from first dropdown and doesn't selects anything from the
> second dropdown, it displays me an error message saying "This field is
> required". But now I have a scenario wherein, on selecting a particular
> value from first dropdown should not force the user to select something
> from the second dropdown (i.e he should be able to proceed even if he
> doesn't selects anything from the second dropdown). How can I implement
> this is Struts ?
> 
> TIA,
> 
> Priya
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 



-- 
-- 
Kranti Kiran Kumar Parisa
Software Engineer [ e-Biz ],
Patni Computer Systems Ltd.,
India
Mobile: +91 98504 45977

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


Re: Error Handling in Struts

Posted by James Mitchell <jm...@apache.org>.
Depending on which version of Struts you are using, use requiredif or
validwhen.

See the online documentation for further details.

 http://struts.apache.org/userGuide/dev_validator.html



--
James Mitchell
Software Engineer / Open Source Evangelist
EdgeTech, Inc.
678.910.8017
AIM: jmitchtx

----- Original Message -----
From: "Priya Jotwani" <Pr...@infosys.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Wednesday, September 29, 2004 9:25 AM
Subject: Error Handling in Struts


Hi,



I have a JSP Page which has two dropdown fields. If the user selects
something from first dropdown and doesn't selects anything from the
second dropdown, it displays me an error message saying "This field is
required". But now I have a scenario wherein, on selecting a particular
value from first dropdown should not force the user to select something
from the second dropdown (i.e he should be able to proceed even if he
doesn't selects anything from the second dropdown). How can I implement
this is Struts ?



TIA,

Priya







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


Re: Error Handling in Struts

Posted by Erik Weber <er...@mindspring.com>.
Where is the complication? During validation? If so, perhaps using 
requiredif/validwhen rules would help. This way, the validator can be 
told to forego validation on the second field if the value of the first 
field passes some test (matches some value). A common example of this is 
where you have a checkbox with a drop down that is associated with it. 
If the checkbox is checked, the user must select some value in the drop 
down. If the box is unchecked, the drop down can remain on the default. 
I have used requiredif to do this. The Struts documenation gives 
examples of this. I haven't tried validwhen but I would assume it's just 
as good or better.

If you are using manual validation then it would seem you just need some 
simple conditional logic that works the same way -- don't validate the 
second field if the value of the first field matches some value, right?

Erik


Priya Jotwani wrote:

>Hi,
>
> 
>
>I have a JSP Page which has two dropdown fields. If the user selects
>something from first dropdown and doesn't selects anything from the
>second dropdown, it displays me an error message saying "This field is
>required". But now I have a scenario wherein, on selecting a particular
>value from first dropdown should not force the user to select something
>from the second dropdown (i.e he should be able to proceed even if he
>doesn't selects anything from the second dropdown). How can I implement
>this is Struts ?
>
> 
>
>TIA,
>
>Priya
>
> 
>
>
>  
>

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


Re: Error Handling in Struts

Posted by Kranti Parisa <kr...@gmail.com>.
How u r getting the error message.. urself has done something for it..
is that error message u r getting is a javascript alert?? or u r
getting that frm application.properties file??? i mean java side???


On Wed, 29 Sep 2004 18:55:19 +0530, Priya Jotwani
<pr...@infosys.com> wrote:
> Hi,
> 
> I have a JSP Page which has two dropdown fields. If the user selects
> something from first dropdown and doesn't selects anything from the
> second dropdown, it displays me an error message saying "This field is
> required". But now I have a scenario wherein, on selecting a particular
> value from first dropdown should not force the user to select something
> from the second dropdown (i.e he should be able to proceed even if he
> doesn't selects anything from the second dropdown). How can I implement
> this is Struts ?
> 
> TIA,
> 
> Priya
> 
> 



-- 
-- 
Kranti Kiran Kumar Parisa
Software Engineer [ e-Biz ],
Patni Computer Systems Ltd.,
India
Mobile: +91 98504 45977

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