I'd like to respond to this discussion from long ago because I need to solve it now for my application.

I don't know about Tapestry 4.0 but for 3.0 it's really hard to solve.

If you want to encode some session information in the url parameters instead of using session/visit or cookies, not only do you need to take care of the Link components, but also the "action" url in Form components, and furthermore 3rd party complex components which contains links in them, such as the Tree and Table components. How could you add the extra parameter to the "pages" links in Table? There's no renderer parameter to set either for Table or TablePages. What if you are using many other 3rd party complex components such as those in Taco or Tassel?

The problem is further complicated by calls to "throw new RedirectException(String)" etc. You must make sure to add the url parameter to every call of url redirection.

Is there a more elegant way?

Regards.

FromRobert Zeigler <[EMAIL PROTECTED]>
SubjectRe: How to add a qurey parameter to all generated links?
DateFri, 13 May 2005 03:35:08 GMT
That's why you make your custom component. Or, in tapestry-4.0, you can
do as Howard suggested. It would be all of five minutes work (probably
closer to 2 or less, with spindle) to create a component that wraps
PageLink and sets the renderer once i that component; you can then
use your custom component throughout your app /instead/ of page link.
Seems a bit simpler an approach than subclassing to return the
appropriate link renderer. But, to each his own. :)

Robert

Preston L. Bannister wrote:
Specifying a renderer for each PageLink in the HTML would be tedious,
especially given all the links within this application *must* encode
this additional parameter.

Perhaps I do not understand your meaning.

Robert Zeigler wrote:

Question: why not just specify your custom renderer to the page link
component?

<a jwcid="@PageLink" page="somePage"
renderer="ognl:defaultLinkRenderer">Some Link</a>

You could wrap the page link component in your own custom component,
specify the renderer in your custom component, and then just you your
AppPageLink (or whatever you decide to call it) throughout your
application. :)



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

Reply via email to