0 Replies Latest reply on Feb 1, 2013 3:50 PM by 427678

    Unable to get correct resourceid from ResourceRequest in weblogic jsf portl

    427678
      On clicking a link from JSF portlet in weblogic, I am creating a ResourceURL using RenderResponse object and setting resourceID as "ajax-getData".

      But the problem is inside serveResource method, when I try to get getResourceID() using ResourceRequestobject, the value is coming as "/faces/#" when I print its value. But I am expecting it to be "ajax-getData". Why am I not getting it?

      Please find the necessary sample code below --
      JSF
      ===
      
           <h:outputLink value = "#" onclick="#{JavaScriptPortletSessionBean.portletInstanceLabel}_issueAjax('#{JavaScriptPortletSessionBean.ajaxDataURL}');">
                    <h:outputText value="Invoke Portlet Data API via Ajax"/>
           </h:outputLink>
      
      JavaScriptPortletSessionBean.getAjaxDataURL()
      =============================================
      
          FacesContext fc = FacesContext.getCurrentInstance();
                   Object obj = fc.getExternalContext().getResponse();
             if (obj instanceof RenderResponse){
                               rresponse = (RenderResponse) obj;
                           ajaxUrl = rresponse.createResourceURL();
                           ajaxUrl.setResourceID("ajax-getData");
              }
      
      serveResource
      =============
      
           public void serveResource(ResourceRequest request, ResourceResponse response)
                throws PortletException, IOException{
                  String resourceid = request.getResourceID();
                  System.out.println("resourceid" + resourceid);
      EDIT: When I tried to change the value of outputLink as follows -
           <h:outputLink value = "abc" onclick="#{JavaScriptPortletSessionBean.portletInstanceLabel}_issueAjax('#{JavaScriptPortletSessionBean.ajaxDataURL}');return false;">
                <h:outputText value="Invoke Portlet Data API via Ajax"/>
           </h:outputLink>
      I am getting the value of resource id printed as "/faces/abc"

      Edited by: gopikrish on 1 Feb, 2013 7:49 AM