This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Exception:validateRequired  RSS feed

 
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am facing this error while writing a code for client side validation using Struts Validator FrameWork.

[2/27/06 21:01:16:316 IST] 56ec08f6 Validator E org.apache.commons.validator.Validator reflection: org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest)
[2/27/06 21:01:16:332 IST] 56ec08f6 Validator E org.apache.commons.validator.Validator TRAS0014I: The following exception was logged java.lang.NoSuchMethodException: org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest)
at java.lang.Class.getMethod1(Class.java(Compiled Code))
at java.lang.Class.getMethod(Class.java:1056)
at org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:401)




Login.jsp

<script type="text/javascript" language="Javascript1.1">
function save()
{
if (validateMyForm(document.forms[0]))
{
document.forms[0].action = 'login.do';
document.forms[0].submit();
}
}

</script>
</HEAD>
<html:form action="/login.do" onsubmit="return save(this);">

<html:errors/>
<P>User ID : <INPUT type="text" name="loginId" size="20"><BR>
Password : <INPUT type="password" name="passWd" size="20">
<BR>
<BR>
<INPUT type="submit" name="Submit" value="Submit">
</P>
</center>
</html:form>
<html:javascript formName="myForm" dynamicJavascript="true" staticJavascript="true" /
 
thomas davis
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Continues....
struts-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

<struts-config>

<!-- Data Sources -->
<data-sources>
</data-sources>

<!-- Form Beans -->
<form-beans>
<form-bean name="myForm" type="com.patni.temp3.form.MyForm">
</form-bean>
</form-beans>

<!-- Global Exceptions -->
<global-exceptions>
</global-exceptions>

<!-- Global Forwards -->
<global-forwards>
</global-forwards>

<!-- Action Mappings -->
<action-mappings>
<action path="/login" type="com.patni.temp3.action.LoginAction"
input = "/login.jsp"
name="myForm"
scope="request"
validate="true">
<forward name="success" path="/welcome.jsp"/>
</action>

</action-mappings>

<!-- Message Resources -->
<message-resources parameter="com.patni.temp3.resources.ApplicationResources"/>

<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>

VALIDATOR-RULES.XML
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE form-validation PUBLIC "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN" "validator_1_0.dtd">

<form-validation>

<global>

<validator name="required"
classname="org.apache.struts.validator.FieldChecks"
method="validateRequired"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
org.apache.commons.validator.Validator,
javax.servlet.http.HttpServletRequest"
msg="errors.required">
<javascript><![CDATA[
function validateRequired(form) {
if (fields.length > 0) {
focusField.focus();
//DataCommerce Modification: Modified to display error msgs as text on screen instead of in alert boxes.
//alert(fields.join('\n'));
displayMessage(fields);
}
return isValid;

</global>

</form-validation>

VALIDATION.XML

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE form-validation PUBLIC

"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN"

"validator_1_0.dtd">


<form-validation>
<formset>
<form name="myForm">
<field property="loginId" depends="required">
<msg name="required" key="loginId.required" />
</field>
<field property="passwd" depends="required">
<msg name="required" key="password.required" />
</field>
</form>
</formset>
</form-validation>
 
I suggest huckleberry pie. But the only thing on the gluten free menu is this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!