[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:       Kaspar Fischer <fischerk () inf ! ethz ! ch>
Date:       2007-11-29 22:49:47
Message-ID: 68BCDA02-7901-4BC1-9285-A571B3145DDF () inf ! ethz ! ch
[Download RAW message or body]


On 29.11.2007, at 11:02, Ulrich Stärk wrote:

> 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.

Hi Uli,

That was it! It turns out that the

   @InjectObject("infrastructure:request")
   public abstract WebRequest getRequest();

is not needed anymore with this solution.

Thanks a lot for the help,
Kaspar

P.S. For the sake of completeness, here is the complete
solution -- in case somebody else needs it.

public abstract class MyPage extends BasePage
   implements PageBeginRenderListener {

   public void pageBeginRender(PageEvent event)
   {
     super.pageBeginRender(event);

     // find out the node we're suppost to show
     IRequestCycle cycle = getRequestCycle();
     String myParam = cycle.getParameter("myParam");
   }

   // ...
}

public class KCNodeServiceEncoder implements ServiceEncoder {
   // ...

   public void decode(ServiceEncoding encoding)
   {
     // ... (get parameter value from URL)

     encoding.setParameterValue("myParam", value);
   }
}
---------------------------------------------------------------------
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