Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic


Mohd Junaid Khan
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am new to struts framework . I am developing a web application and i need to use validator framework to validate the input provided by the User...... The problem i am facing here is if there is any error (user provides wrong input) then the error messages are being displayed but i am unable to hold the invalid data entered by the user...... and moreover all my fields get empty if user provides wrong value in only one field................. can any one please tell me what to do..................

1----------plugin tag in struts-config.xml is
struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
2--------- validation.xml

<form name="loginForm1">
<field property="userLoginID" depends="required">
<arg key="inputForm.userLoginID"/>

<field property="password" depends="required">
<arg key="inputForm.password"/>

3.-------------------------Action Mapping

<!-- ========== Form Bean Definitions ================================ -->
<form-bean name="loginForm1"
type="net.sample.ui.form.LoginForm" />
<action path="/signIn"
path="/jsp/common/home.jsp" />

4--------------- FormBean
package net.sample.ui.form;
public class LoginForm extends ValidatorForm{
public LoginForm() {
private String userID;
private String password;
public String getUserID() {
return userID;

* @param userID the userID to set
public void setUserID(String userID) {
this.userID = userID;

* @return the password
public String getPassword() {
return password;

* @param password the password to set
public void setPassword(String password) {
this.password = password;

5.-------------Action Class

contains only one statement inside execute function

return map.findForward("ACTION_FORWARD_SUCCESS");


I tried all the possible things i could do......... but in vain
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!