Binding component output to a string
Ian Baxter <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I'm trying to programmatically generate the HTML output for a
reusable WOComponent and bind that output to a WOString. I've found a
way to do this, however, when an action is invoked from the component
who's content was generated (the component contains a form) I get the
following exception:
<WorkerThread0> java.lang.NullPointerException
at com.webobjects.appserver._private.WOForm._enterFormInContext
(WOForm.java:58)
at com.webobjects.appserver._private.WOForm.invokeAction(WOForm.java:
79)
at com.webobjects.appserver.WOComponent.invokeAction
(WOComponent.java:945)
at com.webobjects.appserver.WOSession.invokeAction(WOSession.java:1168)
at com.webobjects.appserver.WOApplication.invokeAction
(WOApplication.java:1375)
at
com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWit
hPreparedPage(WOComponentRequestHandler.java:196)
at
com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWit
hPreparedSession(WOComponentRequestHandler.java:287)
at
com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWit
hPreparedApplication(WOComponentRequestHandler.java:322)
at
com.webobjects.appserver._private.WOComponentRequestHandler._handleReque
st(WOComponentRequestHandler.java:358)
at
com.webobjects.appserver._private.WOComponentRequestHandler.handleReques
t(WOComponentRequestHandler.java:432)
at com.webobjects.appserver.WOApplication.dispatchRequest
(WOApplication.java:1306)
at com.webobjects.appserver._private.WOWorkerThread.runOnce
(WOWorkerThread.java:173)
at com.webobjects.appserver._private.WOWorkerThread.run
(WOWorkerThread.java:254)
at java.lang.Thread.run(Thread.java:613)
Here is the code I'm using to generate the HTML string I'm binding to
the WOString in the parent component:
public String generateOutput() { // This is bound to a WOString in
the parent component, thus displaying the component "MyComponent".
MyComponent myComponent = (MyComponent)pageWithName("MyComponent");
myComponent.takeValueForKey(displayGroup, "displayGroup");
myComponent.takeValueForKey(product, "product");
WOResponse response = myComponent.generateResponse();
return response.contentString();
}
MyComponent contains a form with a few buttons that perform actions
on the bound WODisplayGroup.
You're probably wondering why do I need to do this... The short
answer is that I'm using a template engine, and I need to give users
a way to place the output of components in their templates.
Any help would be much appreciated.
Thanks,
Ian Baxter
_______________________________________________
WebObjects-dev mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/webobjects-dev