org.apache.tapestry.contrib.link
Class FormLinkRenderer
java.lang.Object
org.apache.tapestry.link.DefaultLinkRenderer
org.apache.tapestry.contrib.link.FormLinkRenderer
- All Implemented Interfaces:
- ILinkRenderer
public class FormLinkRenderer
- extends DefaultLinkRenderer
A link renderer that ensures that the generated link uses POST instead of GET
request and is therefore no longer limited in size.
Theoretically, browsers should support very long URLs, but in practice they
often start behaving strangely if the URLs are more than 256 characters. This
renderer uses JavaScript to generate forms containing the requested link
parameters and then "post" them when the link is selected. As a result, the
data is sent to the server using a POST request with a very short URL and
there is no longer a limitation in the size of the parameters.
In short, simply add the following parameter to your DirectLink
,
ExternalLink
, or other such link components:
renderer = "ognl: @org.apache.tapestry.contrib.link.FormLinkRenderer@RENDERER"
and they will automatically start using POST rather than GET requests. Their
parameters will no longer be limited in size.
- Since:
- 4.0
- Author:
- mb
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RENDERER
public static final ILinkRenderer RENDERER
- A public singleton instance of the
FormLinkRenderer
.
Since the FormLinkRenderer
is stateless, this instance can
serve all links within your application without interference.
FormLinkRenderer
public FormLinkRenderer()
renderLink
public void renderLink(IMarkupWriter writer,
IRequestCycle cycle,
ILinkComponent linkComponent)
- Description copied from interface:
ILinkRenderer
- Renders the link, taking into account whether the link is
disabled
.
This is complicated by the fact that the rendering of the body must be done
within a nested writer, since the Link component will not render its tag
until after its body renders (to allow for any wrapped components that need
to write event handlers for the link).
The renderer is expected to call back into the link component to handle
any informal parameters, and to handle events output.
- Specified by:
renderLink
in interface ILinkRenderer
- Overrides:
renderLink
in class DefaultLinkRenderer
Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.