January 31, 2003
Looking for more Webwork insight
*oops* I Re-added my blog today, and it looks like every entry got put on todays list somehow...sorry
So, I just wanted to start out saying that the more I interact with Webwork the more I enjoy the ride and thanks to Epesh, Jason Carreira and Llucifer I have a much better understanding now, thanks you guys!
One of my questions, coming from struts ideas to webwork ideas, and looking through example code and such, is that it seems Actions have request data tied into them in other words there is no ActionForm/Javabean like seperation, and every data field has protected access instead of private,I'm used to having properties be private so I initially wrote them with that visibility, but that breaks the property stack? My terminology may be off, but I hope I'm getting my confusion across. Is this how its supposed to be? I kind of think the idea of the ActionForm and Action is good.
Actually what I really think would be great is if I didnt have to write any code to deal with request parameters at all or write beans for them,Let the framework take care of it. if I could just specify parameter names I'm expecting in views.properties, that would be cool! eg
login.action=LoginAction
login.sucess=index.jsp
login.failure=login.action
login.parameters=name,password
And then my action and view could just automagically pick up these values with getter/setters or property attribues provided by the framework.
Posted by Andre Mermegas at January 31, 2003 01:24 AM
| TrackBack
Hi again Andre! I'm glad you're making progress with Webwork.
With Webwork you can choose to either have the properties right in the Actions (like merging the Action and ActionForm) or to populate a separate bean using BeanUtil.setProperties(ActionContext.getParameters(), new myFormBean)
Your properties don't have to be protected. Webwork uses reflection to find the get and set methods for your properties, so if you have (in your action):
public void setFoo(String foo)
and
public String getFoo()
then, if there is a parameter "foo" in your request (either in the URL or as a POST param), then Webwork will find the setFoo() method and call it to populate your action for you. So it's even easier than your example, because you don't have to tell Webwork what to look for!
You could join the WW list: http://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
People there are friendly and helpful, except for that FreeMarker tool who dropped in the other day (he appears to be gone now).
Ok quickie question if you use the BeanUtil.setProperties(ActionContext.getParameters(), new myFormBean) way, how do you access the property in , which doesnt seem to be working.