Tuesday, June 4, 2013

Explain RenderMode annotation?

The GenericPortlet class not only provides separate methods for rendering content in different portlet modes, it allows you to have developerfriendly render method names. This is achieved using the @RenderMode annotation for render methods.

This is the syntax:
@RenderMode(name=<portlet mode name>)

where <portlet mode name> is the name of the portlet mode (VIEW, EDIT, or HELP).


You can annotate a method with @RenderMode if it has the following signature:
void <method_name> (RenderRequest, RenderResponse) throws
PortletException, IOException.  where <method_name> is a developer-friendly method name for the render method.

The following code snippet shows an @RenderMode annotation indicating that the
method is a render method for the VIEW portlet mode:


@RenderMode(name = "VIEW")
public void sayHello(RenderRequest request, RenderResponse response)
throws PortletException, IOException {
...
}

No comments:

Post a Comment