Thanks again for your help.
So, my two jsp are : commercialplanList.jsp and commercialplanPrint.jsp.
I have one form : CommercialPlanForm.class
I have one action class : CommercialPlanAction.class
Here is my struts-config :
<action path="/commercialplan"
type="com.mypack.CommercialPlanAction"
name="commercialPlanForm"
scope="request"
input="/mainmenu.do">
<forward name="displayList" path="commercialplanList"/>
<forward name="displayEdit" path="commercialplanEdit"/>
<forward name="displayPrint" path="commercialplanPrint"/>
<forward name="failure" path="mainMenu"/>
</action>
<action path="/commercialplanprint"
type="com.mypack.CommercialPlanAction"
name="commercialPlanForm"
scope="request"
input="/mainmenu.do">
<forward name="displayList" path="commercialplanList"/>
<forward name="displayEdit" path="commercialplanEdit"/>
<forward name="displayPrint" path="commercialplanPrint"/>
<forward name="failure" path="mainMenu"/>
</action>
In validation.xml, I have :
<formset>
<form name="/commercialplan">
<field
property="prop1"
depends="required">
<arg0 key="prompt.prop1"/>
</field>
<field
property="prop2"
depends="required">
<arg0 key="prompt.prop2"/>
</field>
</form>
</formset>
<formset>
<form name="/commercialplanprint">
<field
property="prop3"
depends="required">
<arg0 key="prompt.prop3"/>
</field>
</form>
</formset>
See the fields to be validated in commercialplanList.jsp are prop1 and prop2
and the field to be validated in commercialplanPrint.jsp is prop3.
Now, I wrote in my jsps :
in commercialplanPrint.jsp : <html:form action="/commercialplanprint">
and in commercialplanList.jsp : <html:form action="/commercialplan">
And CommercialPlanForm.class extends ValidatorActionForm
Now when I try to access commercialplanPrint.jsp I still have an error that
says :
javax.servlet.jsp.JspException: No form found under 'commercialPlanForm' in
locale 'fr'
at
org.apache.struts.taglib.html.JavascriptValidatorTag.renderJavascript(JavascriptValidatorTag.java:364)
at
org.apache.struts.taglib.html.JavascriptValidatorTag.doStartTag(JavascriptValidatorTag.java:335)
at
org.apache.jsp.commercialplanPrint_jsp._jspx_meth_html_javascript_0(commercialplanPrint_jsp.java:734)
at
org.apache.jsp.commercialplanPrint_jsp._jspService(commercialplanPrint_jsp.java:210)
What am I doing wrong ?
Thanks !
Seyhan Basmaci <[EMAIL PROTECTED]> wrote:
in your struts config file ,
define two map to same action class,
for example , pathA and PathB
in validation.xml,, define validation for each path,,
I hope it works :),
formset>
-----Original Message-----
From: julie gautier [mailto:[EMAIL PROTECTED]
Sent: Friday, January 14, 2005 2:07 PM
To: Struts Users Mailing List
Subject: RE: Different validations for one form
Ok, but I have the same action class too... So how will it know that for one
jsp, it's a validation and for the other jsp it's the other validation to use...
My two jsp share the same form and the same action class...
Do you have an idea ?
Thanks for your help.
Seyhan Basmaci wrote:
you can use form based validation or action based validation in struts 1.2 ,
1) to use form based validation,
form classes must extend ValidatorActionForm or DynaValidatorActionForm classes.
(org.apache.struts.validator.ValidatorActionForm,org.apache.struts.validator.DynaValidatorActionForm)
2) to use action based validation ,
form classes must extend ValidatorForm or DynaValidatorForm classes.
(org.apache.struts.validator.ValidatorForm,org.apache.struts.validator.DynaValidatorForm)
in this case,
you must give action name instead of form name in your validation.xml file such
as,
formset>
..........................
you must use second way, take it easy..
-----Original Message-----
From: jgfa92004 [mailto:[EMAIL PROTECTED]
Sent: Friday, January 14, 2005 1:11 PM
To: [email protected]
Subject: Different validations for one form
Hi everybody,
Here is my problem : I have two jsp that share the same action class
(and the same form). As they don't contain the same fields, I would
like to have two different validations : one for each jsp. I use
Validator and Struts 1.2. How can I do that ?
Thanks in advance.
Julie
---------------------------------------------------------------------
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]
---------------------------------
D�couvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Cr�ez votre Yahoo! Mail
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------
D�couvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Cr�ez votre Yahoo! Mail