Thanks for the answer, Aleksej.

The problem is, this URL must be generated on a java thread (or class) that
is not an instance of BasePage and is not a tapestry page. That means i have
no access to ExternalService, right?
Also, I can't use @Any component because this url will be sent as an email
to the user (as a simple text).

Valdemaras Repšys

On 7/18/06, Aleksej <[EMAIL PROTECTED]> wrote:

Valdemaras Repšys wrote:
> Hi,
> i need my application to send emails with the link to the specific
> tapestry
> page. How would i generate a link?
>
> I tried extending a page with IExternalPage and using the address:
> http://localhost:8080/BioJazz/app?service=external/HitList
> What i get is RuntimeException: No engine service named
> 'external/HitList'
> is available.
>
> Link (as in ExternalService API doc):
> http://localhost:8080/BioJazz/app?service=external&context=HitList
> gives a
> null pointer exception:
>
>   - org.apache.hivemind.util.Defense.notNull(Defense.java:41)
>   -
> org.apache.tapestry.engine.RequestCycle.getPage(RequestCycle.java:242)
>
>   - org.apache.tapestry.engine.ExternalService.service(
>   ExternalService.java:144)
>   -
$IEngineService_10c8121ee8c.service($IEngineService_10c8121ee8c.java)
>
>
> Any hint?
> Thanks,
> Valdemaras Repšys
>
Do not form links manually, use "tapestry.services.External" service (
in your case ).
First inject it into your page with something like:
<inject property="externalService"
object="service:tapestry.services.External" /> in your page file.
Be sure that you have a externalService property getter like:
public abstract IEngineService getExternalService();
Then, when you need to generate link, just use
"org.apache.tapestry.engine.ExternalServiceParameter"
to generate your page parameters ( name and Object[] ) and call
getExternalService().getLink(  your parameter object ).
This will return ILink object and you will be able to call
getAbsoluteURL on it, which will return required Link as a string.
On the page you can probably put it using @Any component, like:
<a jwcid="@Any" href="yourLink">go go go</a>
-------------
GL




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to