File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts-validations
 
Similar Threads
Struts Validation not working
Problem with Validator Framework
Form validation in struts
Errors are not getting displayed on JSP when DynaValidatorActionForm is used.
Validation framework not working for login screen