> I tried overriding onPassivate() and returned
>
> return new Object[] { userSession.getViewType(),
> userSession.getTeam().getId() };
>
> but it does not appear in the URL.
>
> What should be done to get it there??

In onActivate you detect that these values are not present and return
"this" so that your page will be redirected with the values from
onPassivate().

pseudo-ish code:


onActivate(value1, value2) {
  fieldForValue1 = value1;
  fieldForValue2 = value2;
}

onActivate() {
  if ( fieldForValue1 == null || fieldForValue2 == null ) return this;
  // assumes that you always have values returned by onPassivate
otherwise you'll infinite loop!
}

onPassivate() {
 return new Object[] { userSession.getViewType() ||
"DEFAULT_USER_TYPE", userSession.getTeam().getId() ||
"DEFAULT_TEAM_ID" };
}


On Fri, May 27, 2011 at 12:25 PM, hese <1024h...@gmail.com> wrote:
>
> Hi,
>
> I have two select controls on my page.  I populate these two select controls
> based on the role and other settings for this user.  Now, what I am trying
> to achieve is to add a restful URL access to the page depending on values in
> these two controls so the page can be bookmarked.  Something like this -
>
> /mypage/Value1/Value2 - should populate Value1 in the first control and
> Value2 in the second control and load the page accordingly.  I've
> implemented this by overriding onActivate(EventContext ec) and checking 'ec'
> for these values and populating the page accordingly.  So far so good.  But
> what happens when the user does not manipulate the url? I still want the URL
> to have the currently selected values.  (like the user logs in and goes to
> /mypage (the default page after login) I want the URL to automatically
> become - /mypage/Value3/Value4)
>
> I tried overriding onPassivate() and returned
>
> return new Object[] { userSession.getViewType(),
> userSession.getTeam().getId() };
>
> but it does not appear in the URL.
>
> What should be done to get it there??
>
> Thanks for any help!!
>
>
>
>
>
> (This is the first page the users goes to when he/she logs in.)
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/how-to-add-values-to-URL-in-onPassivate-tp4433180p4433180.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

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

Reply via email to