Thanks, for the help Jason, Great explanation. It’s working now and I’m back on my way to happily exploring more stuff =D
Regards, -Andre Mermegas
-----Original Message-----
Andre, You'll want to do ActionContext.getContext() instead of new ActionContext(). ActionContext.getContext() gets the ThreadLocal instance which is populated by the ServletDispatcher. You'll probably also want to maintain a reference to your TestBean :-) Here's an example: public class TestAction
extends ActionSupport { public
TestBean getMyBean() { public
void setMyBean(TestBean myBean) {
protected String doExecute() throws Exception { Then, in your success.jsp, which is mapped as the success result of TestAction in the views.properties or actions.xml (see the docs for how to configure actions and view mappings), you can do this: <webwork:property value="myBean"> <!-- This will call getMyBean() on your action and put it on the top of the value stack --> The name is:
<webwork:property value="name"/> <!-- This will call
getName() on your TestBean and print it to the page This is a good way to do it if you have several parameters from the TestBean that you want to display, but, if you have just one, like in this case, it's probably better to do this: <webwork:property value="myBean/name"/> Which will call getMyBean.getName() and print that out to the page. Hope that helps. I've also put this up on the Wiki: -----Original Message-----
Sent:
Friday,
January 31, 2003 9:00 PM Hey all, In my Action.doExecute()
TestBean has one property "name". How do I access the "name" property using the ww taglibs? <ww:property value="name"/> doesn’t seem to be hitting the bean. <ww:property value="$name"/> does work, picking up the request parameter directly. I thought maybe I had to name the object bean and then pass it in, like TestBean tb = new TestBean(); and then pass in the tb object and do <ww:property value="tb/name"/> but that doesn’t work either. I've been looking through the docs, but I cant find it. I know I'm not hitting the Bean on the view. Regards,
Regards,
|
Title: RE: [OS-webwork] how to access bean property?
- [OS-webwork] how to access bean property? Andre Mermegas
- RE: [OS-webwork] how to access bean property? Jason Carreira
- RE: [OS-webwork] how to access bean property? Andre Mermegas
- RE: [OS-webwork] how to access bean property? Andre Mermegas
- RE: [OS-webwork] how to access bean property? Erik Beeson
- RE: [OS-webwork] how to access bean proper... Andre Mermegas
- RE: [OS-webwork] how to access bean property? Jason Carreira