You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by juraj Lenharcik <ju...@datainput.de> on 2001/09/10 19:47:22 UTC
AW: Example to use javascript to validate field input in JSP not
null and be integer ?
why not server side? with ActionForm and validate?
jsp:
=====
<form:form action="chart.do" method="get" >
<tr>
<td colspan="2"><font color="red"><html:errors property="datumFrom"
/></font></td>
</tr>
<tr>
<td>Datum von: </td>
<td><form:text property="from" size="15"/></td>
<tr>
...
the form bean:
=====
public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {
ActionErrors errors = new ActionErrors();
if (from == null || from.length() == 0 || blabla = blubb) {
errors.add("datumFrom", new
ActionError("error.filter.datum"));
}
return errors;
}
and the struts config:
====================
<action path="/chart"
type="di.workerClient.action.ActionFilter"
name="filter"
scope="request"
==> when failure return to form : input="/cstree/content.jsp"
<==
validate="true" >
<forward name="view" path="/cstree/chartcontent.jsp" />
<forward name="fehler" path="/cstree/content.jsp" />
</action>
juraj
-----Ursprüngliche Nachricht-----
Von: Julia Yang [mailto:jyang@graviton.com]
Gesendet: Montag, 10. September 2001 19:33
An: struts-user@jakarta.apache.org
Betreff: Example to use javascript to validate field input in JSP not
null and be integer ?
All
Does anybody can give me a small Example or explanation on how to use
javascript to validate field input in JSP not null and be integer ?
Thanks
Julia