Pass Parameter to Portlet on Page - JSR Struts Portlet - Websphere

This is a discussion on Pass Parameter to Portlet on Page - JSR Struts Portlet - Websphere ; Hi, I have a requirement to pass the search term to a JSR Struts portlet. I used 'Model SPI' to pass parameter to portlet on page by adding additional parameters for Struts portlet namely parameters.put("spf_strutsAction", new String[]{"/redirect.do"}); // sample structs ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: Pass Parameter to Portlet on Page - JSR Struts Portlet

  1. Pass Parameter to Portlet on Page - JSR Struts Portlet

    Hi,



    I have a requirement to pass the search term to a JSR Struts portlet. I used 'Model SPI' to pass parameter to portlet on page by adding additional parameters for Struts portlet namely



    parameters.put("spf_strutsAction", new String[]{"/redirect.do"}); // sample structs action redirect.do

    parameters.put("spf_ActionName", new String[]{"spf_ActionListener"});



    and this works fine from anonymous page.



    However, this does not work when the user is logged in. I'm passing HttpServletRequest and ServletResponse objects in addition to pagename, portletname and param map for generating the URL.



    Could you let me know if I need to do anything else to make this work from authenticated page. I'm on WPS 6.0.1.3


    Thanks

  2. Re: Pass Parameter to Portlet on Page - JSR Struts Portlet

    well one problem is the struts action name


    String[] profileValue3 = {"!2fyouraction.do"};



    you should have this

    parameters.put("spf_strutsAction", new String[]{"!2fredirect.do"}); // sample structs action redirect.do



    which statemanager are you using to generate this url? and have you correctly named the portlet window you are targeting?



    IBM Certified System Administrator -- WebSphere Portal V6.0, V5.1, V5.0

    IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0



    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM

  3. Re: Pass Parameter to Portlet on Page - JSR Struts Portlet

    My Bad. Actually the function I use handles this. Attached is the java file that contains code that generates URL to a particular portlet on a page.


    I'm invoking the 'generateURLFromMap' function from portal theme. It works perfectly when the user is not logged in. One reason I could think of is that the request and response are simple HTTP ones. Could it be like the request/response should be PortletRequest/Response (authenticated) for generating authenticated URLs?



    Can I create a sample portlet and invoke the same function from portlet JSP to see what happens from there?



    Please let me know.



    Thanks

  4. Re: Pass Parameter to Portlet on Page - JSR Struts Portlet

    no it should not matter, the big issue is that you are calling the portal state manager, In your portlets you should call the portletstatemanager service



    So instead of the generic StateMangerService get this one

    com.ibm.portal.state.service.PortalStateManagerSer vice;



    yes you can put it in the jsp of a portlet.



    the big problem though seems to be that you are using the most generic statemanagerservice(which can also be used for offline generation) and when that object is used it often cannot be used to target actions for authenticated pages, so that is my best guess on why this is happening



    Jim



    IBM Certified System Administrator -- WebSphere Portal V6.0, V5.1, V5.0

    IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0



    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM

  5. Re: Pass Parameter to Portlet on Page - JSR Struts Portlet

    I figured this out finally. The reason why it did not work for authenticated users is because I had created a new JSP in themes from which the function was being invoked. Apparently, it looks like Portal does not like new JSPs to be created in themes as they dont get the same set of implicit objects.



    I invoked this code from existing theme JSP/JSPF and it worked like a charm!

  6. Re: Pass Parameter to Portlet on Page - JSR Struts Portlet

    how were you calling this JSP ? if you were just redirecting users to a page that did not require auth, then yeah the objects will not be in the request for it to determine the acl for the user and will not let you go to the action phase then





    IBM Certified System Administrator -- WebSphere Portal V6.0, V5.1, V5.0

    IBM Certified Solution Developer -- WebSphere Portal V5.1, v6.0



    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM

  7. Re: Pass Parameter to Portlet on Page - JSR Struts Portlet

    I actually created a new JSP and posted search form from banner_searchControl.jspf to this page. I was calling the function from this new page and then doing a redirect.



    Now, I have changed the code to post the form to that URL with request parameter as form parameter and it works fine.

+ Reply to Thread