• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

anybody who know struts' DynaActionForm?

 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
tumbleweed and gunslinger
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
I miss the old days when I would think up a sinister scheme for world domination and you would show a little emotional support. So just look at this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic