I'd try getErrors() first, although if validation is set to true I don't believe your action will fire, and instead will be forwarded to the input forward.
tanalyw tan
Greenhorn
Joined: Mar 09, 2010
Posts: 10
posted
0
Hi i tried using getErrors() in my action. However, it doesnt even hit my action. I tried with both validation true and false. Any idea?
Yes, either *actually* manually, by dealing with the form, or by calling the framework mechanism.
For example, I always had a base action class that went to the input forward on a GET, and called validate() on a POST.
Jimmy Clark
Ranch Hand
Joined: Apr 16, 2008
Posts: 2187
posted
0
Aside, there is no html:errors element in the JSP. This is what is used to display the errors returned by the validation.
tanalyw tan
Greenhorn
Joined: Mar 09, 2010
Posts: 10
posted
0
I have been trying it around and searching for tutorials. I am able to get the error message printed out using <html:errors>.
However, what I am really looking for is something like this:
When user click on the submit button, the form will be sent to the action class.
Validation using struts validation framework will be used in the action class itself, to check for errors like duplicate name (compare with values from database) etc..
However, what I am doing now is before the form reach the action, it is already validated. But that is not what I need. I need the validation to be done in the action class itself. Correct me if I am wrong.. thanks. Any idea??
Also, please UseAMeaningfulSubjectLine when posting. Explaining your question or remark briefly on the subject line allows us to know what we are getting into, and if we will be able to help. A subject of "Struts framework" in a forum dedicated to Struts isn't very helpful. Thanks!