input parameter in portal theme - Websphere

This is a discussion on input parameter in portal theme - Websphere ; Hi , I want to put one common input field in portal theme and then pass its value to portlet. I have already used Portlet:navigation URL to create a link to this portlet and it is working fine. here i ...

+ Reply to Thread
Results 1 to 15 of 15

Thread: input parameter in portal theme

  1. input parameter in portal theme

    Hi ,



    I want to put one common input field in portal theme and then pass its value to portlet.



    I have already used Portlet:navigation URL to create a link to this portlet and it is working fine. here i m sending a parameter with url to the target portlet and it is recieved successfully at the target portlet.


    But now i want to take this parameter from user. but not able to do it.



    Please help me out.

    Thanks


  2. Re: input parameter in portal theme

    Not totally sure here, but I do believe you need to create a servlet filter to make this possible if you are using JSR168 Portlets. I know that there should be a good article about this on Developerworks, but I'm not able to find it right now - instead I found this...which might lead you on the way



    URLhttp://www-1.ibm.com/support/docview.wss?uid=swg21288750[/URL]

  3. Re: input parameter in portal theme

    you will need to use the url generation tags or the url generation api to get this to work. I refer to the theme url generation tags.



    You do need to target the portlet specifically as the parameter would not be available otherwise to the portlet.



    If multiple portlets need access to this I would look at using some kind of singleton portlet service to share this information between the theme and the portlets



    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

  4. Re: input parameter in portal theme

    Hi,



    I have done this type of scenario in my project to establish a communication between the search in the theme and to the search portlet.



    What I did was, I have set the parameter in request in the theme jsp by the following code



    <% if(request.getParameter("sampleName")!=null)

    {

    request.setAttribute("sarchKey",request.getParameter("sampleName"));

    }%>



    And you can get the value in the portlet by the following code..



    //Getting HttpServletRequest from PortletUtils.getInternalRequest() method in

    //com.ibm.wps.pe.pc.std.core.PortletUtils(in wp.pe.rt.api.jar)



    PortletRequest portletRequest=(PortletRequest)request;

    HttpServletRequest httpReq=PortletUtils.getInternalRequest(portletReq uest).getHttpServletRequest();



    if(httpReq.getAttribute("sarchKey")!=null)

    {

    System.out.println("The value from theme::"+httpReq.getAttribute("sarchKey").toString());

    }



    Hope this helps you....



    Gangadhar

  5. Re: input parameter in portal theme

    Thx for Reply and help.



    I did the same assuggested by Gangadhar, and it was working fine.



    I can recieve parameters in my doview method of all portlets on that page.

    Gangadhar can u please explain how this code works, how portlet request converts into httpServletrequest.



    I need ur help in one more thing. I want to add this attribute to session, so it is available to all portlets, not to only those whose doview method is called.

    So i have decided to add it to session.



    Following ur code i have added this line in theme default.jsp



    request.getSession(true).setAttribute("sess", "20");



    and in doview of portlet



    PortletSession ps=request.getPortletSession(true);



    if(ps!=null){



    HttpSession hts=PortletUtils.getInternalSession(ps).getHttpSes sion();

    if(hts.getAttribute("sess")!=null){

    System.out.println("The value from session::"+hts.getAttribute("sess").toString());

    request.setAttribute("sess",hts.getAttribute("sess").toString() );

    }

    }




    i have made sure that portlet session is true in jsps.



    But i m not getting the attribute.



    Can u plz look into it..



    Thx in advance



    Monika


  6. Re: input parameter in portal theme

    To things to bear in mind casting the request object to the httpservletrequest object is not guaranteed to work on all jsr 168 implementations.



    The recommended way to share data among portlets in different wars is to use the following

    http://www-128.ibm.com/developerworks/websphere/librar y/techarticles/0602_hepper/0602_hepper.html



    you can access in the theme as well, instead of accessing it with a portlet request use the session id, as all portlets and theme share the same session id, when you ask the portlet service for the data it uses the session id as part of the key, and that is how you can share it across the theme and portlets.



    The session objects will be scoped to an individual web app and items will not be shared across them.



    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: input parameter in portal theme

    May be the way in which Jim has explained will work, I am just suggesting an alternative way using which we have implemented.



    In the JSP page when you say simply request , you will have httpserverltrequest.



    So , there are two possible ways.. I can suggest you, to my knowledge..



    1)Set it in ApplicationScope of the portlet in doView() saying that... request.getPortletSession().setAttribute(key, value, Session.APPLICATION_SCOPE);



    by this way.. you can get them in HttpSession...



    Now you can say in the page.. request.getSession().getAttribute(key);



    2)Set the value in your doView() once you get the attribute from Theme...



    like request.getPortletSession().setAttribute(key,value );



    Now in the page... say portletRequest.getPortletSession().getAttribute(ke y); .



    Dont simply say.. request.getSession()...



    This way... you should get it....



    Gangadhar

  8. Re: input parameter in portal theme

    how do you get your param from the input ?
    do you use a javascript function ? ...

  9. Re: input parameter in portal theme

    THe only limitation is that portlets and the theme are not in the same web app


    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

  10. Re: input parameter in portal theme

    sorry , didnt get your answer, is that mean that its impossible ?

  11. Re: input parameter in portal theme

    Hi,

    This is the code i have used to send parameter from theme to one specified portlet.

    For this we have to give unique name to portlet (="ibm.portal.registration")and its layoutnodes("ibm.comp.view"). It will target doview method of portlet. we can recieve the parameter through request.getParameter("CrNo").

    <portal-navigation:urlGeneration contentNode="ibm.portal.registration" layoutNode="ibm.comp.view">
    <portal-navigation:urlParam name="key" value="Delta" type="render" />
    <form name="f1" action="<% wpsURL.write(out); %>">
    <input type="text" name="CrNo" maxlength="8" size="8">

    <input type="submit"


    </form>
    </portal-navigation:urlGeneration>

    Thanks
    Monika

  12. Re: input parameter in portal theme

    Hi,
    thanks for replying but the <portal-navigation:urlParam name="key" value="Delta" type="render" />
    Actually what i want is to send the value of an input in the theme to a portlet.
    Thanks

  13. Re: input parameter in portal theme

    hi,
    you can use the same code, i m sending one input text also
    <input type="text" name="CrNo" maxlength="8" size="8">

    you can delete url paramaeter code <portal-navigation:urlParam name="key" value="Delta" type="render" />

    Thx

  14. Re: input parameter in portal theme

    Hi monika,
    im still getting a null form my getParameter in the doview ..here is my code :
    <portal-navigation:urlGeneration contentNode="CC.CCTestPage"
    layoutNode="CC.myPortlet"
    portletWindowState="Maximized" accessControlCheck="NoCheck">

    <portal-navigation:urlParam name="myJSRParam" value="fromURLParam" type="render" />

    <form name="myForm" action="<% wpsURL.write(out); %>" >
    <label for="directorySearchCriteria" >Search for:</label>
    <input id="directorySearchCriteria" name="directorySearchCriteria" type="text" />


    <input type="submit" value="GO" />
    </form>

    </portal-navigation:urlGeneration>


    any ideas ?

  15. Re: input parameter in portal theme

    Hi,
    Could you able to solve the problem, I need to get the form value in the portlet render phase, please let me know. Thank you for your help in advance.

+ Reply to Thread