Re: pageWithName
Re: pageWithName
- Subject: Re: pageWithName
- From: Mark Morris <email@hidden>
- Date: Mon, 9 Apr 2007 08:43:38 -0500
Hello Drew,On Apr 8, 2007, at 5:32 PM, Drew Thoeni wrote: I'm sure I'm missing a small bit of common WOKnowledge, because this seems pretty basic. But help would be greatly appreciated.
I'm sending an HTML email using a WOComponent as the source. I've done this before from within another component but I'm now trying to do this in a separate (non-WOComponent) standard Java class.
I started with:
EmailHTMLTemplate mailPage = (EmailHTMLTemplate)pageWithName( "EmailHTMLTemplate" );
If I'm understanding your problem correctly, this can't work, because the Java class you're in doesn't respond to "pageWithName". Remember, you're sending messages to objects, and if you're not explicit the message will get sent to "self".
And got "cannot find symbol"
Thinking the errant symbol might be "pageWithName", I tried this:
EmailHTMLTemplate mailPage = (EmailHTMLTemplate)WOApplication.application().pageWithName( "EmailHTMLTemplate", context() );
For the same reason, this can't work, because your Java class doesn't understand the message "context()".
Ditto. So, do I need to pass in a context()? If so, how? (FYI: this is a static method and being called from a WOComponent).
Or, am I looking at this all wrong and trying to force fit something? Anytime I get into a spot like this I think back to Jonathan Rentzsch's "If you're writing code, you're doing something wrong" maxim. Perhaps I'm headed in the wrong direction.
Regards,
Drew
You're most likely going to have to pass *something* in so your class has some hook to get to the context. If an instance of this class is associated with a session, then you could pass in the session in the object's constructor. Then you could always get back to what you need.
Hope this helps!
Regards, Mark
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >pageWithName (From: Drew Thoeni <email@hidden>) |