This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Dynmic Getter and Setter Methods? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Dynmic Getter and Setter Methods?" Watch "Dynmic Getter and Setter Methods?" New topic

Dynmic Getter and Setter Methods?

Edward Durai
Ranch Hand

Joined: Oct 09, 2004
Posts: 223
Hi Struts Experts,

I have one Question,
My Aim is to create the Custom Fields using Struts.
My Question Is : Is it possible to create Run Time Getter and Setter

Please Send Your Suggestions.

A.Edward Durai

Thank You<br />Edward
Pawan Rao
Ranch Hand

Joined: Dec 29, 2005
Posts: 30
Yes, this can be done. You have to improve the proxy package, we can create the new class at runtime.

Stop not till the goal is reached...
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Just use org.apache.struts.validator.LazyValidatorForm as your ActionForm bean. This class automatically gets and sets whatever property you put in an <html:xxx> tag. Fields do not have to be predefined in any way.
[ July 22, 2006: Message edited by: Merrill Higginson ]

Consultant, Sima Solutions
subject: Dynmic Getter and Setter Methods?
Similar Threads
Problem in Struts 1 html form rendering and populating ?
Bean New class wont compile
Why and When to use reflections
How To Pass Data From A Servlet To A Helper Class
nested logic iterate does not set actionform on submit