I have designed a fully function struts application. I am at the point of implemeneting Validation for my application.
So for starters this is what I would like to do:
The entry point into my application is a logon page that prompts the user to enter a username, password, and database name (automatically populated in a drop down menu). The user then clicks on a Connect button that opens a database connection to the specified database. Everything works fine if the user enters valid data.
I now need to implement validation as below: 1. If the user doesn't enter anything for username or password. 2. If the user enters an invalid username or password.
I can do 1 using the validate method in my ActionForm. However I don't understand how the control flow for this works - as in how and what I need to change in my struts-config.xml and my JSP page and my properties file.
I don't know where to start from for 2.
I'd greatly appreciate any assistance on 1 or 2 or both,
go through the struts validation documentation here. That should clear up most of your doubts
posted 13 years ago
I went through the documentation for Struts Validation. Thank you mannu.
I am however having problems with my validation.xml and validation-rules.xml. Firstly, I'm not sure if these files are being deployed. Secondly, when I try to validate them (in JBuilder X), I get this error:
IOException: jakarta.apache.org: jakarta.apache.org for both files.
validator-rules.xml is automatically generated by JBuilder when the validation option in struts is selected. I don't know why this doesn't work and this is how my validation.xml looks like:
OK. I figured out why my validation.xml was not valid - My formset tag was not closed properly at the end. However I still cant get my validator-rules.xml to validate. I'm still getting the IO Exception (previously defined). Please assist. I think it has to do with the DTD definition but I'm not sure.