You are getting the NPE because you are not using a factory method to create
your D2W pages. The factory creates a d2wContext. You should never use the
WOComponent constructor directly either. Always use WOApp, WOAction, or
WOComponent's pageWithName() factory method.
If you want to reuse a query, ERD2W does that :-) Look at the saved queries
stuff in ERD2W. I believe David Holt has an example of this somewhere.
You'll want to be careful with that though. Your model changes over time. The
queries you store in the database don't. You'll need to validate them before
you run them. I don't know if ERD2W does this for you. I think it does, but
I've not gotten around to using saved queries just yet. (I need to separate
the implementation from the userPreferences stuff for it to be useful to me.
You may have the same requirement.)
Ramsey
On Mar 26, 2012, at 12:09 PM, James Cicenia wrote:
> I have a very custom D2WQueryPage.
>
> I would like to reuse the results of this querypage.
>
> Is this possible?
>
> I am instantiating it as such:
>
> TOSD2WQueryPage queryPage = new TOSD2WQueryPage(context());
> queryPage.setEntityName("PortfolioProject");
>
> However, I get a null exception:
>
> at
> com.webobjects.directtoweb.D2WComponent.setEntity(D2WComponent.java:336)
> at
> com.webobjects.directtoweb.D2WComponent.setEntityName(D2WComponent.java:356)
> at com.tos.tab.TabSystem.changeReportProject(TabSystem.java:403)
>
> Why? I am setting the Entity Name? Or is this just not possible?
>
> Thanks
> James
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/rgurley%40smarthealth.com
>
> This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]