aspose file tools
The moose likes Struts and the fly likes Confused on validate() method Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Confused on validate() method" Watch "Confused on validate() method" New topic
Author

Confused on validate() method

Gregg Bolinger
Ranch Hand

Joined: Jul 11, 2001
Posts: 15230

If I am using DynaValidatorForm in my struts-config.xml, then why do I still need a Class with a validate() method? I thought that using the dynamic validation on standard validation like, required, mask, etc you didn't need to write the validation code anywhere?
It is kind of like, we used DynaForm to lose the Bean class that just sets and gets variables, which is good, but then we just add another class that is to handle the validation even though we have dynavalidatorform classes?
I am just really confused on this. Why is this so hard for me? STRUTS is making me lose sleep, but everyone thinks it is the best thing in the world? I want to learn how to use it, and I even have 2 books. Of couse both books give "code snippets" which I hate because they never tell you what class they belong to. ARRRGGGG Sorry, just venting a little.
Can someone give me a good clear answer to my question(s)? And please don't tell me to go look at the Newsletter. I have looked at it, the examples, and I have made them work. But it is not making me understand WHY.
Thanks.
Gregg Bolinger
Ranch Hand

Joined: Jul 11, 2001
Posts: 15230

Ok, I got some validation to work on my form. The problem is now I am getting the stupid little alert() box telling me what validated wrong. That is worse than all the Messages at the top of the page.
I really need this explained to me or something. I will see if I can post some of this code. Right now, I am only validating the one TitleField.
AddReferenceAction

AddReferenceBean - This has the validate() method

My FORM Tag in my validation.xml file

My FORM-BEAN in my struts-config.xml

AddReference.jsp

application.properties file

[ August 05, 2003: Message edited by: Gregg Bolinger ]
[ August 05, 2003: Message edited by: Gregg Bolinger ]
Gregg Bolinger
Ranch Hand

Joined: Jul 11, 2001
Posts: 15230

Ok, I finally found a decent tutorial that took a little bit different approach and really utalized 1.1's validation. So I lost the AddReferenceBean class and below is my AddReferenceAction class revised:
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Confused on validate() method
 
Similar Threads
about servlet-mapping
anybody who know struts' DynaActionForm?
why different kind of validations in Struts.explain me
Can I validate my form using Struts-Portlet framework functionality
Struts Validation for non formdata