1 2 Previous Next 17 Replies Latest reply on Apr 27, 2011 4:54 AM by Trong Tran

    Get "GET" parameter for a portlet?

    Steffen Kau Newbie

      Hi gatein forum members,

       

      I tried to create a portlet which displayed my get parameter from the url.

      The Code of the portlet looks like:

       

      public voidprocessAction(ActionRequest request, ActionResponse response) throwsPortletException, PortletSecurityException, IOException

         {

            Enumeration e =request.getParameterNames();

            String name;

            while (e.hasMoreElements()) {

               name = (String) e.nextElement();

              response.setRenderParameter(name,request.getParameter(name));

            }

         }

       

         protected void doView(RenderRequest req,RenderResponse resp) throws IOException

         {

            try

            {

               resp.setContentType("text/html");

               StringBuffer html = newStringBuffer();

       

               html.append("<br/>");

               html.append("<b>HelloPortal World!</b>");

               html.append("<br/>");

              html.append("<BR/><BR/>RenderRequest Parameters");

               Enumeration e =req.getParameterNames();

               String name;

               while (e.hasMoreElements()) {

                  name = (String) e.nextElement();

                 html.append("<BR/>  " + name +"="

                        + req.getParameter(name));

               }

       

              resp.getWriter().write(html.toString());

            }

            catch(Exception e)

            {

               e.printStackTrace();

            }

         }

       

      I made a page in my portal und add this portlet.

      After it I tried to browsed this page with

      http://localhost:8080/myportal/private/bth/Portlets?param1=eins&param2=zwei

      but my portlet don’t show any parameter.

      Has anyone an idea why I the request object don’t have any got parameter ?

       

      Cheers

      Steffen

        1 2 Previous Next