Topic
  • 2 replies
  • Latest Post - ‏2013-02-12T19:39:47Z by shiva1248
shiva1248
shiva1248
4 Posts

Pinned topic Urgent Help - renderrequest and Portlet preferences in Servlet

‏2013-02-12T16:28:32Z |
HI ,

Could some one please tell me how to get handle of render request in servlet
I tried below codes but did not work.
Servlet is called through ajax

protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
try {

if (request.getAttribute("javax.portlet.request") instanceof RenderRequest) {
RenderRequest renderRequest = (RenderRequest) request
.getAttribute("javax.portlet.request");
if (renderRequest != null) {
System.out.println("render request got it");
} else {
System.out.println("unable to get render request");
}

}
} catch (Exception e) {
e.printStackTrace();
}

and also using util
http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Developing_JSR_portlets_in_a_regular_Java_IDE
I think once I get handle of renderrequest I can get handle of portletpreferences using request.getPreferences()
Updated on 2013-02-12T19:39:47Z at 2013-02-12T19:39:47Z by shiva1248
  • Mark_Winton
    Mark_Winton
    110 Posts

    Re: Urgent Help - renderrequest and Portlet preferences in Servlet

    ‏2013-02-12T17:57:55Z  
    What type of portlet are you using, and where's the servlet request coming from?

    If it's a JSR 268 portlet you could create your own portlet class an override the serveResource method (the ResourceRequest argument should allow access to the preferences through its getPreferences() method).

    On top of that, if it's a JSF 2 portlet you should be able to call the serveResource method (complete with parameters) via the following code:

    > <portlet:resourceURL><portlet:param name="foo" value="bar" /></portlet:resourceURL>

    Alternatively though JSF's native ajax support (rather than having to use IBM's hx extensions) has improved these days, so you may also be able to access the information you're after through that approach.
  • shiva1248
    shiva1248
    4 Posts

    Re: Urgent Help - renderrequest and Portlet preferences in Servlet

    ‏2013-02-12T19:39:47Z  
    What type of portlet are you using, and where's the servlet request coming from?

    If it's a JSR 268 portlet you could create your own portlet class an override the serveResource method (the ResourceRequest argument should allow access to the preferences through its getPreferences() method).

    On top of that, if it's a JSF 2 portlet you should be able to call the serveResource method (complete with parameters) via the following code:

    > <portlet:resourceURL><portlet:param name="foo" value="bar" /></portlet:resourceURL>

    Alternatively though JSF's native ajax support (rather than having to use IBM's hx extensions) has improved these days, so you may also be able to access the information you're after through that approach.
    Hi mark,

    Thanks for your reply
    Here FetchData is the servlet
    I want to get PortletPreferences in fetchData servlet

    Assuming I do'nt want to use serverResource - what is other alternative for JSR 168 ?

    $(document).ready(function () {

    $("#datatablecol1").dataTable({
    "bServerSide": true,
    "sAjaxSource": "<%=renderResponse.encodeURL(renderRequest.getContextPath()+ "/FetchData")%>",
    "bProcessing": true,
    "sPaginationType": "full_numbers",
    "bJQueryUI": true,
    "bSort": false,
    "iDisplayLength": 10,