[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 312
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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