jaggernat
asked on
problem with struts validation
hi experts,
I am using struts in Jbuilder 2005 with weblogic application server.
For some reason my field validations are not getting enabled.
My JSP page----------
<html:form action="/incidentManagemen t.do?metho d=saveInci dentType" method="post">
<html:errors/>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<html:text styleClass="formstyle" property="submittingOrgani zation" size="20"/>
</table>
</html:form>
MY STRUTS CONFIG--------
<action name="incidentsBn" path="/incidentManagement" parameter="method" validate="true"
input="/WEB-INF/pages/comm andcenter/ incidents/ heprCCCAdd Incident.j sp" type="gov.njdhss.hippocrat es.command center.act ion.incide nts.Incide ntsAction" >
<forward name="listIncidents"
path="/incidentManagement. do?method= listIncide nts" />
<forward name="listIncidentsPg"
path="/WEB-INF/pages/comma ndcenter/i ncidents/h eprCCCList Incidents. jsp" />
<forward name="findIncidentsPg"
path="/WEB-INF/pages/comma ndcenter/i ncidents/h eprCCCFind Incidents. jsp" />
<forward name="listFoundIncidentsPg "
path="/WEB-INF/pages/comma ndcenter/i ncidents/h eprCCCFoun dIncidents .jsp" />
<forward name="updateIncidentsPg"
path="/WEB-INF/pages/comma ndcenter/i ncidents/h eprCCCUpda teIncident .jsp" />
<forward name="errorIncidents"
path="/WEB-INF/pages/comma ndcenter/i ncidents/h eprCCCErro rIncident. jsp" />
<forward name="incidentConfirmation Pg"
path="/WEB-INF/pages/comma ndcenter/i ncidents/h eprCCCInci dentConfir mation.jsp " />
<forward name="createIncidentsLocat ionPg"
path="/WEB-INF/pages/comma ndcenter/i ncidents/h eprCCCAddI ncident.js p" />
<forward name="createIncidentsPg"
path="/WEB-INF/pages/comma ndcenter/i ncidents/h eprCCCAddI ncident.js p" />
</action>
<form-bean name="incidentsBn" dynamic="true"
type="gov.njdhss.hippocrat es.command center.act ion.incide nts.Incide ntsFormBea n"/>
MY VALIDATION.XML fILE------------
<form name="incidentsBn">
<field property="submittingOrgani zation" depends="required">
<arg0 key="submittingOrganizatio n.msg"/>
</field>
</form>
AND MY APPLICATION RESOURCEs
#Errors messages
errors.required={0} is Required.
submittingOrganization.msg = Submitting Organization
any help would be greatly appreciated
thanks ,
J
I am using struts in Jbuilder 2005 with weblogic application server.
For some reason my field validations are not getting enabled.
My JSP page----------
<html:form action="/incidentManagemen
<html:errors/>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<html:text styleClass="formstyle" property="submittingOrgani
</table>
</html:form>
MY STRUTS CONFIG--------
<action name="incidentsBn" path="/incidentManagement"
input="/WEB-INF/pages/comm
<forward name="listIncidents"
path="/incidentManagement.
<forward name="listIncidentsPg"
path="/WEB-INF/pages/comma
<forward name="findIncidentsPg"
path="/WEB-INF/pages/comma
<forward name="listFoundIncidentsPg
path="/WEB-INF/pages/comma
<forward name="updateIncidentsPg"
path="/WEB-INF/pages/comma
<forward name="errorIncidents"
path="/WEB-INF/pages/comma
<forward name="incidentConfirmation
path="/WEB-INF/pages/comma
<forward name="createIncidentsLocat
path="/WEB-INF/pages/comma
<forward name="createIncidentsPg"
path="/WEB-INF/pages/comma
</action>
<form-bean name="incidentsBn" dynamic="true"
type="gov.njdhss.hippocrat
MY VALIDATION.XML fILE------------
<form name="incidentsBn">
<field property="submittingOrgani
<arg0 key="submittingOrganizatio
</field>
</form>
AND MY APPLICATION RESOURCEs
#Errors messages
errors.required={0} is Required.
submittingOrganization.msg
any help would be greatly appreciated
thanks ,
J
Also, make sure your formbean extends ValidatorForm.
Acton
Acton
ASKER
yes i did put the plug-in
also , this is my dtd info in validatio.xml file .
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">
also , this is my dtd info in validatio.xml file .
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">
ASKER
>>>>>Also, make sure your formbean extends ValidatorForm
does validation framework not work with Action Forms?
does validation framework not work with Action Forms?
>> does validation framework not work with Action Forms?
In order to trigger the validation, you need to extends ValidatorForm.
In order to trigger the validation, you need to extends ValidatorForm.
ValidatorForm is a subtype of Action Form which provides you validation capability.
If you just extend normal ActionForm, validation function will be turned on automactically.
see this:
http://www.oracle.com/technology/oramag/oracle/04-jan/o14dev_struts.html
If you just extend normal ActionForm, validation function will be turned on automactically.
see this:
http://www.oracle.com/technology/oramag/oracle/04-jan/o14dev_struts.html
ASKER
i cannot use ValidaorForm now. we have completed 50% of the project using Actionform. Is there any other alternative
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
>>>only incidentsFormBean has to be changed
so does that mean i have to avoid using IncidentsformBean(action form) and put all the fields in struts config under <form-bean name=IndcidentformBean type="...DynavalidatorForm "..> tag
so does that mean i have to avoid using IncidentsformBean(action form) and put all the fields in struts config under <form-bean name=IndcidentformBean type="...DynavalidatorForm
<plug-in className="org.apache.stru
<set-property property="pathnames" value="/WEB-INF/validator-
</plug-in>