[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tapestry-user
Subject:    Re: Dynamic pages (or: arguments to pages) [T4]
From:       Ulrich_Stärk <uli () spielviel ! de>
Date:       2007-11-29 10:02:44
Message-ID: 474E8E44.6070307 () spielviel ! de
[Download RAW message or body]

These are just guesses, I haven't tried them nor verified them.
I could imagine that the parameter isn't available via the WebRequest 
because the page didn't get called by a GET request directly but with 
the help of the service encoder, so your parameter isn't there anymore 
when the page get's rendered. Try to get hold of the IRequestCycle by 
calling getRequestCycle() and call getParameter on it. I wouldn't be 
surprised if it's in there.

Cheers,

Uli

Kaspar Fischer schrieb:
> Unfortunately, my solution does not really work yet. My page
> uses
> 
>   @InjectObject("infrastructure:request")
>   public abstract WebRequest getRequest();
> 
>   public void pageBeginRender(PageEvent event)
>   {
>     super.pageBeginRender(event);
> 
>     WebRequest request = getRequest();
>     id = request.getParameterValue("id")); // (*)
>   }
> 
> to read the Id of the page to display. This indeed works:
> 
>   http://localhost/app?id=someid
> 
> results in id from (*) being set to "someid".
> 
> I now wanted to support friendly URLs and wrote a ServiceEncoder
> whose decode() method extracts the Id form a URL like
> 
>   http://localhost/node/id.html
> 
> and sets it:
> 
>   public void decode(ServiceEncoding encoding)
>   {
>     // ...
>     String id = // ...
> 
>     encoding.setParameterValue(ServiceConstants.SERVICE, 
> Tapestry.PAGE_SERVICE);
>     encoding.setParameterValue(ServiceConstants.PAGE, _className);
>     encoding.setParameterValue("id", id);
> }
> 
> But although the variable encoding contains the parameter "id"
> with its value (I verifed this), the page's pageBeginRender() from
> above receives null.
> 
> I feel I misunderstand something here. Why are parameters not
> passed on to the page request?
> 
> Many thanks,
> Kaspar
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic