This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes struts-validations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts-validations" Watch "struts-validations" New topic
Author

struts-validations

sudha javvadi
Ranch Hand

Joined: Mar 23, 2007
Posts: 97
Hi All,

I did a sample application using struts1.3.8. I have two fields username and password. Even though I am entering username and password I am getting a message "username is required" . What might went wrong? I really couldn't guess , so please help me. Below is the part of struts-config.xml and validation.xml.

//struts-config.xml

<action path="/login"
type="actions.LoginAction"
name="loginForm"
scope="request"
attribute="login"
validate="true"
input="/pages/login.jsp" >
<forward name="success" path="/pages/regSuccess.jsp" />
</action>

//validation.xml
<form name="login">
<field property="username" depends="required">
<arg key="login.username" />

</field>
<field property="pwd" depends="required">
<arg key="login.pwd" />
</field>
</form>
tanveer chowdry
Greenhorn

Joined: Jul 17, 2007
Posts: 21
I don't see any problem with the code. Do you also have validate method in the form ? that may be getting called since you have set validate="true" in the action mapping.

Can you mail the code. I will be able to figure out.


Regards,<br />tanveer<br /> <br />SCJP 1.4 (86%)<br />SCWCD 1.5 (98%)
sudha javvadi
Ranch Hand

Joined: Mar 23, 2007
Posts: 97
Thankyou for your reply tanveer. I got what the mistake I made. Now it is working correctly.

sudha.
SCJP 5
 
 
subject: struts-validations
 
Similar Threads
Form validation in struts
Errors are not getting displayed on JSP when DynaValidatorActionForm is used.
Problem with Validator Framework
Struts Validation not working
Validation framework not working for login screen