Hello all,
I am developing Report Application Form using Struts.I have set everything right, web.xml,struts-config.xml,struts-validation.xml.But the application is giving problem while displaying the empty item (should output validation errors).
Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
java.lang.IllegalArgumentException: Resources cannot be null.
at org.apache.commons.validator.Validator.(Validator.java:188)
at org.apache.struts.validator.Resources.initValidator(Resources.java:299)
at org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:106)
and some more lines
This is
jsp page:
<html> ...
<table width="765" border="0" align="center">
<tr>
<th align="left">
<logic:messagesPresent>
<ul>
<font color="red">
<html:messages id="error">
<li><%=error %></li>
</html:messages>
</font>
</ul>
</logic:messagesPresent>
</th>
</tr>
</table>
<html:form method="post" action="/submitFISReport" >
...
<table border="0" cellpadding="2" cellspacing="2" width="100%">
<tr>
<th><bean:message key="fisOutageReport.jsp.outageType" /></th>
<td>
<html:select property="outageType">
<html

ption value="ALL">ALL</html

ption>
<html

ption value="Planned">Planned</html

ption>
<html

ption value="Unplanned">Unplaned</html

ption>
</html:select>
</td>
<html:select property="serverName"> ...
...
<table border="0" cellpadding="2" cellspacing="2" width="100%">
<tr >
<th><bean:message key="fisOutageReport.jsp.startDate" /> </th>
<td><html:text name="SubmitFISReportForm" property="startDate" value="03/01/2005" size="10" />
</td>
<th><bean:message key="fisOutageReport.jsp.endDate" />
</th>
<td><html:text name="SubmitFISReportForm" property="endDate" size="10" />
</td>
</tr>
</table>
..
<table>
<html:submit> <bean:message key="fisOutageReport.jsp.submit" /> </html:submit>
<html:reset> <bean:message key="fisOutageReport.jsp.reset" /> </html:reset>
</table>
...
</html>
struts-config.xml:
<struts-config>
<!-- ======================================== Form Bean Definitions -->
<form-beans>
<form-bean name="SubmitFISReportForm" type="rain.SubmitFISReportForm">
</form-bean>
<form-bean name="SubmitFISReportForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="startDate" type="java.lang.String" />
<form-property name="endDate" type="java.lang.String" />
<form-property name="outageType" type="java.lang.String" />
<form-property name="serverName" type="java.lang.String" />
</form-bean>
<form-bean name="EndDateAction"
type="org.apache.struts.action.DynaActionForm">
<form-property name="outageType" type="java.lang.String" />
</form-bean>
<form-bean name="StartDateAction"
type="org.apache.struts.action.DynaActionForm">
<form-property name="serverName" type="java.lang.String" />
</form-bean>
</form-beans>
<!-- ======= Action Mapping Definitions ======= -->
<action-mappings>
<action path="/submitFISReport" forward="/FISOutageReport1.jsp"/>
<action path="/submitFISReport"
type="rain.SubmitFISReportActionForm"
name="SubmitFISReportForm"
scope="session"
validate="true"
input="/FISOutageReport1.jsp"
parameter="action">
<forward name="success" path="/FISOutageReport1.jsp"/>
</action>
</action-mappings>
<!-- ======= Message Resources ======= -->
<message-resources parameter="rain.FISReportResources" />
<!--
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml"/>
</plug-in> -->
</struts-config>
...
struts-validation.xml:
<form-validation>
<formset>
<form name="SubmitFISReportForm">
<field property="startDate" depends="required">
<arg0 key="fisOutageReport.jsp.startDate"/>
</field>
<field property="endDate" depends="required">
<arg0 key="fisOutageReport.jsp.endDate"/>
</field>
<field property="outageType" depends="required">
<arg0 key="fisOutageReport.jsp.outageType"/>
</field>
<field property="serverName" depends="required">
<arg0 key="fisOutageReport.jsp.serverName"/>
</field>
</form>
</formset>
</form-validation>
Thanks help,
Rodgers Tang