• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 359
  • Last Modified:

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="/incidentManagement.do?method=saveIncidentType" method="post">
<html:errors/>

<table width="100%" border="0" cellspacing="1" cellpadding="0">
                            <html:text styleClass="formstyle" property="submittingOrganization" size="20"/>
                          </table>
</html:form>

MY STRUTS CONFIG--------

<action name="incidentsBn" path="/incidentManagement" parameter="method" validate="true"
            input="/WEB-INF/pages/commandcenter/incidents/heprCCCAddIncident.jsp"   type="gov.njdhss.hippocrates.commandcenter.action.incidents.IncidentsAction">

            <forward name="listIncidents"
                   path="/incidentManagement.do?method=listIncidents" />
            <forward name="listIncidentsPg"
                   path="/WEB-INF/pages/commandcenter/incidents/heprCCCListIncidents.jsp" />
            <forward name="findIncidentsPg"
                   path="/WEB-INF/pages/commandcenter/incidents/heprCCCFindIncidents.jsp" />
            <forward name="listFoundIncidentsPg"
                    path="/WEB-INF/pages/commandcenter/incidents/heprCCCFoundIncidents.jsp" />
            <forward name="updateIncidentsPg"
                   path="/WEB-INF/pages/commandcenter/incidents/heprCCCUpdateIncident.jsp" />
            <forward name="errorIncidents"
                   path="/WEB-INF/pages/commandcenter/incidents/heprCCCErrorIncident.jsp" />
            <forward name="incidentConfirmationPg"
                   path="/WEB-INF/pages/commandcenter/incidents/heprCCCIncidentConfirmation.jsp" />
            <forward name="createIncidentsLocationPg"
                  path="/WEB-INF/pages/commandcenter/incidents/heprCCCAddIncident.jsp" />
            <forward name="createIncidentsPg"
                  path="/WEB-INF/pages/commandcenter/incidents/heprCCCAddIncident.jsp" />
      </action>


 <form-bean name="incidentsBn" dynamic="true"
              type="gov.njdhss.hippocrates.commandcenter.action.incidents.IncidentsFormBean"/>


MY VALIDATION.XML fILE------------

<form name="incidentsBn">


<field property="submittingOrganization" depends="required">
<arg0 key="submittingOrganization.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
0
jaggernat
Asked:
jaggernat
  • 5
  • 4
1 Solution
 
actonwangCommented:
did you put the following in your struts-config.xml ?


      <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
            <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
      </plug-in>
0
 
actonwangCommented:
Also, make sure your formbean extends ValidatorForm.

Acton
0
 
jaggernatAuthor Commented:
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">

0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
jaggernatAuthor Commented:
>>>>>Also, make sure your formbean extends ValidatorForm

 does validation framework not work with Action Forms?
0
 
actonwangCommented:
>> does validation framework not work with Action Forms?

     In order to trigger the validation, you need to extends ValidatorForm.
0
 
actonwangCommented:
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
0
 
jaggernatAuthor Commented:
i cannot use ValidaorForm now. we have completed 50% of the project using Actionform. Is there any other alternative

0
 
actonwangCommented:
>>i cannot use ValidaorForm now. we have completed 50% of the project using Actionform

     You don't need to replace all ActionForm by ValidatorForm. Only those forms which need to use validation. In this case, only incidentsFormBean has to be changed.
0
 
jaggernatAuthor Commented:
>>>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

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now