Hi All,
I am a beginner in the Struts world, i have a small application with
I did not understand how display errors on input parameters.
ActionForm.java
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if ((TS_id < 15) || (TS_id > 29))
//The first parameter is the name of the invalid property
errors.add("ON_id",
new ActionError("error.TS_id.mismatch"));
return errors;
}
Index.JSP
<html:form action="/EditTransportStream.do" method="Get">
<td align="left">
TS_Id:<html:text property="TS_id" />
<html:errors property="TS_id"/>
</td>
<html:submit property="submit"/>
</html:form>
ApplicationRessources:
error.TS_id.mismatch=<li>Invalid TS_id, please try again</li>
Web.xml
<action path="/EditTransportStream"
type="struts.XSS_Actions.EditTransportStreamAction"
name="TransportStreamForm"
scope="session"
input="/index.jsp"
validate="true">
<forward name="valid" path="/registration.jsp" />
<forward name="failure" path="/index.jsp" redirect="false" />
</action>
Could someone explain me how define Key for the first parameter of
the add
errors method, if no key is defined do i have to set the parameter
null
to false in the web.xml file ?
(<init-param>
<param-name>null</param-name>
<param-value>false</param-value>
</init-param>
)
Thanks a lot in advance.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>