GeeCON Prague 2014*
The moose likes Struts and the fly likes How does Dyna stuff work in STRUTS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How does Dyna stuff work in STRUTS" Watch "How does Dyna stuff work in STRUTS" New topic
Author

How does Dyna stuff work in STRUTS

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I was wondering how STRUTS does it's DynaFormBean creation? Does it create a .java file and then compile it? Is it all done with relfection and no .java file creation?
Any relevent web site link with this info?
Thanks.


GenRocket - Experts at Building Test Data
Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303
Hi Greg,
I am pretty sure the DynaBeans are creating using introspection. Here is what the Manning book says about the issue:

"The DynaActionForm (org.apache.struts.action.DynaActionForm) is designed so that you can specify simple JavaBean properties through the Struts configuration file.... The DynaActionForm is based on the DynaBean component of the Jakarta Commons [ASF Commons]. This is a clever object that stores the fields in an internal map but exposes them as standard JavaBean properties." (p. 162)

I haven't looked at the Commons code but I think introspection has to be going on if the keys of key / value pairs are being mapped and accessible through getter / setter pairs.
Great question :-)
Darryl
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Thanks Darryl. Where can I find some information on Introspection and how that works? It seems like an interesting concept.
Darryl A. J. Staflund
Ranch Hand

Joined: Oct 06, 2002
Posts: 303
Hi Greg,
I haven't used introspection myself in any direct manner but I think a search for the word 'reflection' will pull up some interesting threads in the 'Advanced Java' forum.
Darryl
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Darryl A. J. Staflund:
Hi Greg,
I haven't used introspection myself in any direct manner but I think a search for the word 'reflection' will pull up some interesting threads in the 'Advanced Java' forum.
Darryl

Thanks again Darryl. I will check it out.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How does Dyna stuff work in STRUTS