aspose file tools*
The moose likes Struts and the fly likes anybody who know struts' DynaActionForm? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "anybody who know struts Watch "anybody who know struts New topic
Author

anybody who know struts' DynaActionForm?

Sean Li
Ranch Hand

Joined: Feb 27, 2002
Posts: 154
I know it's very useful when dealing with many many boring get*** and set*** method of a Action form. but i don't know how to use that. can anybody help me ?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16014
    
  20

Mainly it's a matter of using the DynaForm as your base class and setting up the XML to indicate your fields names. "Ideally" you'll also want to use the pattern-based automatic validators too. I believe that requires a class that extends DynaForm.
The authors of Struts have never been happy with the idea of the Form Bean having controller logic embedded within what was supposed to be a "pure" model (for the record, the ORIGINAL SmallTalk MVC models inherited serialization, so even THEY weren't "pure").
Anyway, pure or not, the ultimate goal is to be able to define the Form Bean entirely declaratively. More run-time overhead in exchange for less programmer overhead.


Customer surveys are for companies who didn't pay proper attention to begin with.
David Yutzy
tumbleweed and gunslinger
Ranch Hand

Joined: Jun 29, 2001
Posts: 192
I've been looking into the DynaForms, but still have issues with the current implementation:
1) No server-side validation. I don't use ANY client-side, javascript crap. Too many times I've had to rewrite stuff for NS, IE, Mac, Opera, etc.
2) Have to cast every call. If I'm declaring the type in the FormBean in struts-config.xml, why do I still have to cast calls?
3) I simply don't want to use validation in XML. There are too many instances where I have to do DB lookups, business logic dependencies, etc. to validate input. The current XML based validation is too Javascript oriented and assumes that simple validation is the only thing you need.
I understand the "seperation" concept and agree it's a good idea, but what is currently being implemented/proposed doesn't work for me nor does it feel streamlined.
This is the other issue I have with Struts in general. How many damn XML and other dependent files do I have to create to do an online form with validation? As the FrameWork evolves, the files are spreading and getting so complex to do something simple is a major undertaking...
Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
Originally posted by David Yutzy:
3) I simply don't want to use validation in XML. There are too many instances where I have to do DB lookups, business logic dependencies, etc. to validate input. The current XML based validation is too Javascript oriented and assumes that simple validation is the only thing you need.

I agree re: the XML-based validation. As for performing complex validation activities even in a Form bean, I've found it isn't worth it. Your mileage of course may vary.
Somewhere in an article on the Struts site it talks about splitting validation into two stages, one stage being the relatively simple pattern-matched/syntactic stuff, the next stage being more business oriented. I've found that to be good advice. Complex validation I leave for the action. Not only does it feel like a better place for code that knows more about back-end services and business logic, but sometimes more complex validation can require different page routing than simple validation.


Reid - SCJP2 (April 2002)
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
Originally posted by David Yutzy:
1) No server-side validation. I don't use ANY client-side, javascript crap. Too many times I've had to rewrite stuff for NS, IE, Mac, Opera, etc.

You are correct in that client-side validation should not be relied on. Server-side validation for DynaActionForms can be handled in a couple of ways. You can subclass DynaActionForm and override the validate() method, or you can use the Struts Validator framework.
3) I simply don't want to use validation in XML. There are too many instances where I have to do DB lookups, business logic dependencies, etc. to validate input. The current XML based validation is too Javascript oriented and assumes that simple validation is the only thing you need.

Only input should be validated through ActionForms/DynaActionForms. Business logic validation should be handled in business objects. This is the reason only simple validation is assumed. So if I have a field that is a name,, the input validation might only check to see that it was two words with no numbers or symbols in it. Separate business logic validation would be used to determine whether or not the name entered is valid to access the system or whatever.
This is the other issue I have with Struts in general. How many damn XML and other dependent files do I have to create to do an online form with validation? As the FrameWork evolves, the files are spreading and getting so complex to do something simple is a major undertaking...

Some people are proponents of moving as much into XML as possible. Therefore you end up with things such as the Validator framework and DynaActionForms. On the other hand, the components are still there for you to do the same things without using XML, such as using regular ActionForms. Struts is flexible. Simply use the parts of Struts that you like, don't use the parts you don't.
Rahul Nair
Ranch Hand

Joined: Dec 01, 2007
Posts: 138
Hello,
Can you please tell me how to validate my DynaActionForm property using Struts validator Framework.

I am already use DynaValidatorForm for validating the property but it is only working for Client Side validation. but not for Server Side validation.

Also some people says by using DynaValidatorActionForm gives control over XML Validation...But I did not find the DynaValidatorActionForm class in my jar file.

Can you plese help me ?

I am instrested in validating DynaActionForm Property using Struts validator Framework.

Thanks
 
Don't get me started about those stupid light bulbs.
 
subject: anybody who know struts' DynaActionForm?