Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Portlet Define Objects tag in jsp

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.17k
    Comment on it

    We use Portlet Define Objects <Portlet:DefineObjects> tag in our JSP code, while developing a portlet in Liferay. We generally use this tag to inherit the predefined objects in our JSP. By doing this, we get escape to write the entire code to include all these objects in oue JSP page.

     

    JSR 168 (Portlet Specification 1.0)

    In JSR 168, there are only three variables are defined:

    1) RenderRequest renderRequest

    2) RenderResponse renderResponse

    3) PortletConfig portletConfig


    The following taglib uri and defineObject tag should be used to include the above mentioned variables in the JSP page, according to JSR 168.

    <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
    
    <portlet:defineObjects/>

     

    JSR 286 (Portlet Specification 2.0)

    In case of JSR 286, following are the defined variables:

    1) RenderRequest renderRequest and RenderResponse renderResponse (when included from render method)

    2) ResourceRequest resourceRequest and ResourceResponse resourceResponse (when included from serveResource method)

    3) ActionRequest actionRequest and ActionResponse actionResponse (when included from processAction method)

    4) EventRequest eventRequest and EventResponse eventResponse (when included from processEvent method)

    5) PortletConfig portletConfig

    6) PortletSession portletSession (it returns an existing session or null if no session exists)

    7) Map<String, Object> portletSessionScope (it provides access to the portletSession attributes, doesn't create a session just returns a session if exists or return empty Map if session doesn't exist)

    8) PortletPreferences portletPreferences (it provides the access to the portlet preferences)

    9) Map<String, String[]> portletPreferencesValues (provides access to the portlet preferences as a Map, it returns an empty Map in case if no portlet preferences exist).

     

    The following taglib uri and defineObject tag should be used to include the above mentioned variables in the JSP page, according to JSR 286.

    <%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
    
    <portlet:defineObjects />

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: