So I was able to get around this issue with the following code. public String getPageLink(String context) { Link link = linkSource.createPageRenderLinkWithContext(SomeClass.class, context);
for(String param : link.getParameterNames()) { link.removeParameter(param); } return link.toURI(); } On Tue, Nov 11, 2014 at 8:53 PM, George Christman <gchrist...@cardaddy.com> wrote: > So I've run into the same problem on a couple of occasions and I've yet to > find a good work around either. Alejandro suggestion doesn't seem to work > for me do to the fact my links are in the layout component and not the > page. Anybody have any suggestions? I agree with Barry, although this may > be helpful in some cases, it seems like a bug in others. If we could just > add null to the parameter, then it would work perfectly for both sides. > > On Mon, May 13, 2013 at 8:49 AM, Barry Books <trs...@gmail.com> wrote: > >> Thanks, >> >> That does exactly what I needed. It appears to be called before the new >> parameters are added so it lets you remove the defaults. >> >> >> On Mon, May 13, 2013 at 7:27 AM, Alejandro Scandroli < >> alejandroscandr...@gmail.com> wrote: >> >> > Hi Barry >> > >> > I've been using a different workaround for this and maybe it could help >> > you. >> > You can listen for the DECORATE_PAGE_RENDER_LINK and then "decorate" the >> > link as you want. >> > Add something like this to your page. >> > >> > @OnEvent(EventConstants.DECORATE_PAGE_RENDER_LINK) >> > void decoratePageRenderLink(Link link, PageRenderRequestParameters >> > parameters) >> > { >> > if (parameters.getLogicalPageName().equals("YOUR_LOGICAL_PAGE_NAME")) { >> > for (String name : link.getParameterNames()) >> > { >> > link.removeParameter(name); >> > } >> > } >> > } >> > >> > Cheers. >> > Alejandro. >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > On Thu, May 9, 2013 at 2:44 PM, Barry Books <trs...@gmail.com> wrote: >> > >> > > I am using @ActivationRequestParameter and perhaps this is feature >> under >> > > some circumstances but currently it seems like a bug to me. >> > > >> > > In this case I have a menu item called 'All Prints' that goes to a >> page >> > > that might set ARP fields from a search. I'd like the menu link to >> always >> > > go to the page without any url parameters so that it will show All >> > Prints. >> > > If I just had a simple PageLink I could just set >> > parameters="{'tag'='All'}" >> > > but the menu links come from a database so they can be dynamically >> > added. >> > > I did get it to work as I wanted by adding a context of 'All' the >> > pagelink >> > > and then set tag to null in begin render. The only think I don't like >> > about >> > > that is the URL ends up being: >> > > >> > > /studio/work/All?tag=Paris (best case would be /studio/work?tag=All >> > which I >> > > don't really care for either) >> > > >> > > I suspect I'll really fix this by hardcoding a URL in the database and >> > just >> > > using <a href="/studio/work/"> but that seems wrong. >> > > >> > > I guess it comes down to what PageLink should do. I view it as a way >> to >> > go >> > > to some arbitrary page with a set of arguments I specify. I'm OK with >> > > leaving context and parameters empty and Tapestry providing defaults >> but >> > it >> > > seems like if I supply a value it should use that and only that. I >> > suppose >> > > there may be other cases where this functionality is useful but I >> can't >> > > think of any off hand. Perhaps if parameters="null" or parameters="{}" >> > > would just remove all parameters that might be OK and would solve the >> > > common case of: >> > > >> > > 1. A menu item linking to a page that shows a bunch of things >> > > 2. The page has search parameters to narrow the list and uses ARP to >> > store >> > > them >> > > >> > > The menu link does not need to know (and should not know) what the >> > possible >> > > set of search criteria is, it just wants to turn them all off. The >> search >> > > page can handle them using EventLink to clear individual ones. >> > > >> > > >> > > >> > > On Wed, May 8, 2013 at 7:06 PM, Howard Lewis Ship <hls...@gmail.com> >> > > wrote: >> > > >> > > > I suspect you are using @ActivationRequestParameter annotatations >> and >> > > that >> > > > is the source of your "sticky" query parameters. >> > > > >> > > > It may be a bug that you explicitly supply an empt parameters map to >> > the >> > > > PageLink and it still adds the ARP in, but that is likely a feature. >> > > > >> > > > To accomplish what you want, you may need to set the ARP fields to >> null >> > > > inside beginRender(). >> > > > >> > > > >> > > > >> > > > On Wed, May 8, 2013 at 6:02 AM, Barry Books <trs...@gmail.com> >> wrote: >> > > > >> > > > > I've got a menu item generated from a database with a pagelink >> like >> > > this >> > > > > >> > > > > <t:pagelink page="prop:drop.page" context="dropContext" >> > > > > style="${drop.style}" >> > > > > >${drop.label}</t:pagelink> >> > > > > >> > > > > >> > > > > I've added a search function to one of the linked pages that adds >> > > > > parameters to the URL with >> > > > > >> > > > > >> > > > > <t:pagelink ... parameters="search">Page</t:pagelink> >> > > > > >> > > > > >> > > > > I'd like to make the menu item clear the search so I tried this: >> > > > > >> > > > > >> > > > > <t:pagelink page="prop:drop.page" context="dropContext" >> style="${drop >> > > > > .style}" parameters="{}">${drop.label}</t:pagelink> >> > > > > >> > > > > >> > > > > but it does not work. It seems Tapestry is clever enough to always >> > add >> > > my >> > > > > search criteria to the parameter map. This would be easy enough to >> > fix >> > > if >> > > > > my menu was not driven from a database but I don't see an easy to >> > make >> > > my >> > > > > generic menu know how to fix this. >> > > > > >> > > > > >> > > > > It would seem useful to be able to say <t:pagelink ... >> > > > > parameters="null">Page</t:pagelink> but parameters cannot be set >> to >> > > null. >> > > > > >> > > > > >> > > > > Any suggestions? >> > > > > >> > > > >> > > > >> > > > >> > > > -- >> > > > Howard M. Lewis Ship >> > > > >> > > > Creator of Apache Tapestry >> > > > >> > > > The source for Tapestry training, mentoring and support. Contact me >> to >> > > > learn how I can get you up and productive in Tapestry fast! >> > > > >> > > > (971) 678-5210 >> > > > http://howardlewisship.com >> > > > >> > > >> > >> > > > > -- > George Christman > CEO > www.CarDaddy.com > P.O. Box 735 > Johnstown, New York > > -- George Christman CEO www.CarDaddy.com P.O. Box 735 Johnstown, New York