GeeCON Prague 2014*
The moose likes Struts and the fly likes How Struts will identify Class (with get / set methods) associated with it Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How Struts will identify Class (with get / set methods) associated with it" Watch "How Struts will identify Class (with get / set methods) associated with it" New topic
Author

How Struts will identify Class (with get / set methods) associated with it

Jay Shukla
Ranch Hand

Joined: Jun 08, 2008
Posts: 214
Hi All,

I amd new to struts and just reffering Struts book of Wrox publications. It is Employe Management application and they have explained that application. It has all the functionality Add/ Delete/ Edit etc. Each JSP page has its own Form Bean classes and on top of that there is one Common class called Employee which has get and set methods of the fields of the tabels.

For the Employee Class they have explaned that this class's object will hold the data of individual employee.

But i do not see how flow from one JSP will pass to this Employee class so thaty values entered by user will be set to the setter method using Reflection. Because in struts-config.xml Form Beans are associated with Each different Action classes and JSP.

Could you help me in understanid Above Concept?

Sorry if the Subject line looks wiered.

Thanks in Advance.
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
Its based on the URL that is sent from the browser to the server. So if the browser sends a request to http://<yourserver>:<yourport>/<yourContext>/SomeAction.do, Then the struts-config.xml will be checked for an action named "SomeAction". If that action is found then the name attribute of that action will be used to find the class of the form to be used.

Hope this helps
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How Struts will identify Class (with get / set methods) associated with it