4 Replies Latest reply on Oct 19, 2007 6:30 AM by dong

    I can't get the parameter  <form> in my portlet

    dong Newbie

      I have a in jsp ex:

      <form method="POST" name="register_form" action="/portal/default/userDisplay/userDisplayWindow?action=2&act=1">
      <input name="uname" type="text" maxLength="100"/>
      <input name="mail" type="text" maxLength="100"/>
      <input type="submit" name="ok" value="OK">


      and in my portlet i want get the value of the form:
      public void doView(RenderRequest request,RenderResponse response)......
      but, the value request.getParameter("uname") is null.
      Thanks for help....

        • 1. Re: I can't get the parameter  <form> in my portlet
          Antoine Herzog Master


          That is strange. I can't detect something wrong in the code.

          You may look at the jsp of the portal (user portlet jsp, samples...) as some example.

          such as :

          <form method="post" action="<portlet:actionURL>
           <portlet:param name="op" value="<%= CMSAdminConstants.OP_DOSEARCH %>"/>
           <input type="text"
           <input type="submit" name="search" value="${n:i18n("CMS_SEARCH")}" class="portlet-form-button"/>

          The url is not hard coded but built with the portal url factory.
          this may be necessary...

          do you get the "act" parameter that is in the url ? or not ?

          oups... I've just got it : the parameters of the url are available in the request of the action method of the portlet.
          not the doView (render method).
          you have to get them in the action method, and then, if you want to get some info about that in the render method (doView), you must do some

          This way, the myRenderParamName is put in the request instance in the doView method.

          look also at the portlet specification JSR-168 for all this...

          • 2. Re: I can't get the parameter  <form> in my portlet
            dong Newbie

            Yes that is strange,
            because this code is run in Jboss Portal 2.0, i can get the parameter in doView() and in processeAction(). I think the problem is Jboss Portlet 2.6 block some method ex: POST.

            in the url, i hava a parameter "act", this parameter i can get in my portlet, but all the parameter like "input name="uname"" i can't :(

            • 3. Re: I can't get the parameter  <form> in my portlet
              Thomas Heute Master

              As Antoine said, you should *really* read the JSR 168 spec.

              And as he said:
              1) You shouldn't create the URL yourself
              2) Your action parameter will be only available in the action phase, if you need them in your render phase you need to pass them along as he wrote