<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Url GET parameters in portlet java code</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=1266387" />
  <subtitle>Url GET parameters in portlet java code</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=1266387</id>
  <updated>2026-07-02T06:06:07Z</updated>
  <dc:date>2026-07-02T06:06:07Z</dc:date>
  <entry>
    <title>RE: Url GET parameters in portlet java code</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=10102529" />
    <author>
      <name>Sangeeta Patra</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=10102529</id>
    <updated>2011-07-22T10:42:21Z</updated>
    <published>2011-07-22T10:42:21Z</published>
    <summary type="html">String strUserType =null;&lt;br /&gt;HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(renderRequest)); &lt;br /&gt;strUserType = httpReq.getParameter(&amp;#34;userType&amp;#34;); &lt;br /&gt;dynamicRequest.setAttribute(&amp;#34;UserType&amp;#34;,strUserType);&lt;br /&gt;		&lt;br /&gt;This code is correct.It worked for me.</summary>
    <dc:creator>Sangeeta Patra</dc:creator>
    <dc:date>2011-07-22T10:42:21Z</dc:date>
  </entry>
  <entry>
    <title>RE: Url GET parameters in portlet java code</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=4102331" />
    <author>
      <name>Ivan Andrew Pointer</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=4102331</id>
    <updated>2009-10-07T06:50:12Z</updated>
    <published>2009-10-07T06:50:12Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Hello,&lt;br&gt;&lt;br&gt;I am not sure if this is the right place for your post, but I have been in your shoes before.  I would like to help.  The first item of note is which IDE are you using?  Are you in NetBeans, Eclipse or (In your case, the best option) Rational?&lt;br&gt;&lt;br&gt;If you are in Rational, your job has been made very easy my friend:&lt;br&gt;&lt;br&gt;Open the portlet.xml file for the web application.  Go to the "Render Parameters" tab.  You need to register a render parameter that you want to receive there.  This would be the name of the parameter coming in on the URL.  In order for a portlet to be allowed scope to the URL parameter, it must be specifically noted.&lt;br&gt;&lt;br&gt;Once your portlet.xml file is updated, the code for accessing the parameter is simple:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;String customerID = renderRequest.getParameter("custID");&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;I believe, but am not sure, that this "getParameter" function can be called by any of the PortletRequest objects (PortletRequest, ActionRequest or RenderRequest).&lt;br&gt;&lt;br&gt;If you are using either NetBeans, Eclipse or another tool, I personally do not know of any automagical way for you to configure the portlet.xml file.  What you are looking for is something similar to:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;
&amp;lt;!--?xml version="1.0" encoding="UTF-8"?--&amp;gt;
&amp;lt;portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0"&amp;gt;
	&amp;lt;portlet&amp;gt;
		&amp;lt;description&amp;gt;AnExamplePortlet&amp;lt;/description&amp;gt;
		&amp;lt;portlet-name&amp;gt;AnExamplePortlet&amp;lt;/portlet-name&amp;gt;
		&amp;lt;display-name&amp;gt;AnExamplePortlet&amp;lt;/display-name&amp;gt;
		&amp;lt;portlet-class&amp;gt;com.somesite.ExamplePortlet&amp;lt;/portlet-class&amp;gt;
		&amp;lt;expiration-cache&amp;gt;0&amp;lt;/expiration-cache&amp;gt;
		&amp;lt;supports&amp;gt;
			&amp;lt;mime-type&amp;gt;text/html&amp;lt;/mime-type&amp;gt;
			&amp;lt;portlet-mode&amp;gt;VIEW&amp;lt;/portlet-mode&amp;gt;
			&amp;lt;portlet-mode&amp;gt;EDIT&amp;lt;/portlet-mode&amp;gt;
			&amp;lt;portlet-mode&amp;gt;HELP&amp;lt;/portlet-mode&amp;gt;
		&amp;lt;/supports&amp;gt;
		&amp;lt;resource-bundle&amp;gt;com.somesite.rb.ExamplePortlet&amp;lt;/resource-bundle&amp;gt;
		&amp;lt;portlet-info&amp;gt;
			&amp;lt;title&amp;gt;Example Portlet&amp;lt;/title&amp;gt;
			&amp;lt;short-title&amp;gt;Example Portlet&amp;lt;/short-title&amp;gt;
		&amp;lt;/portlet-info&amp;gt;
		&amp;lt;supported-public-render-parameter&amp;gt;myParamName&amp;lt;/supported-public-render-parameter&amp;gt;
	&amp;lt;/portlet&amp;gt;
	&amp;lt;public-render-parameter&amp;gt;
		&amp;lt;description&amp;gt;A public render parameter&amp;lt;/description&amp;gt;
		&amp;lt;identifier&amp;gt;custID&amp;lt;/identifier&amp;gt;
		&amp;lt;name&amp;gt;myParamName&amp;lt;/name&amp;gt;
	&amp;lt;/public-render-parameter&amp;gt;
&amp;lt;/portlet-app&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;This is all a part of the JSR 286 Standard and will work in any portal.&lt;br&gt;&lt;br&gt;I hope this helps&lt;br&gt;&lt;br&gt;&lt;img alt="emoticon" src="@theme_images_path@/emoticons/happy.gif"&gt;&lt;br&gt;&lt;br&gt;P.S. You can also check &lt;br&gt;&lt;br&gt;&lt;a href="http://publib.boulder.ibm.com/infocenter/wpzosdoc/v6r1/topic/com.ibm.wp.zos.doc/dev/pltcom_pubrndrprm.html"&gt;this IBM Infocenter page&lt;/a&gt; for additional help; however, I would wait to see if what I suggested above works enough or not as this may confuse.&lt;br&gt;&lt;br&gt;If that does not work yet, the concept you are looking for is "Public Render Parameters", one of the major search engines should turn something useful up for you.&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Ivan Andrew Pointer</dc:creator>
    <dc:date>2009-10-07T06:50:12Z</dc:date>
  </entry>
  <entry>
    <title>RE: Url GET parameters in portlet java code</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=4068992" />
    <author>
      <name>venkat v venkat</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=4068992</id>
    <updated>2009-09-27T03:03:57Z</updated>
    <published>2009-09-27T03:03:57Z</published>
    <summary type="html">&lt;div class="quote-title"&gt;Radu B:&lt;/div&gt;&lt;blockquote&gt;The workaround that was OK for me was to call:&lt;br /&gt;&lt;br /&gt;String queryString = (String)renderRequest.getAttribute(&amp;#34;javax.servlet.forward.query_string&amp;#34;); &lt;br /&gt;&lt;br /&gt;which is giving back the original query string that you can parse with StringTokenizer for instance.&lt;br /&gt;&lt;br /&gt;I am now using FriendlyURL for my portlet. If the portlet is not multiple-instance, the URL will look like&lt;br /&gt;&lt;em&gt;http://server-name/page&lt;/em&gt;/-/FriendlyName/ParameterName/ParameterValue&lt;br /&gt;&lt;br /&gt;which is more nice and SEO friendly than QueryString with portlet  namespace&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Hi All,&lt;br /&gt;&lt;br /&gt;This is Venkat, working as WebSphere Portal Developer with JSR 286 Portlet Development.&lt;br /&gt;&lt;br /&gt;Please share some examples if you have already come across of the below scenario.&lt;br /&gt;&lt;br /&gt;I have a requirement where i need to access the Portal Page Browser&lt;br /&gt;&lt;br /&gt;URL and then i need to parse it.&lt;br /&gt;I am using WebSphere Portal 6.1 and RAD 7.5 using JSR 286.&lt;br /&gt;&lt;br /&gt;So using jsr 286 specifications how can i read the portal browser url.&lt;br /&gt;&lt;br /&gt;To make the requirement more clear, we have an url which comes from&lt;br /&gt;Legacy (outside the portal environment) and opens the portal page, so&lt;br /&gt;the url comes into portal environment has an id appended to it.&lt;br /&gt;&lt;br /&gt;as an example the url looks something like this:&lt;br /&gt;&lt;br /&gt;http://www.abc.com/application/100034&lt;br /&gt;&lt;br /&gt;so based on the appended 100034 value my portal page displays the&lt;br /&gt;content (portlet content).&lt;br /&gt;&lt;br /&gt;How can i parse the value 100034 and get as a string into my portal environment, so that i can display the corresponding content based on that value.&lt;br /&gt;&lt;br /&gt;As of now i have only this requirement with me, i hope i make you guys&lt;br /&gt;understand what is the requirement.&lt;br /&gt;&lt;br /&gt;It would be great favour if you answer me the question.&lt;br /&gt;&lt;br /&gt;Please Please, if anyone come across with the similar requirement or who knows how to do it, please share some step by step process and sample code.( Please do not think that i am asking tooo much, i am really in urgency).&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;&lt;br /&gt;Venkat.</summary>
    <dc:creator>venkat v venkat</dc:creator>
    <dc:date>2009-09-27T03:03:57Z</dc:date>
  </entry>
  <entry>
    <title>RE: Url GET parameters in portlet java code</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=1269229" />
    <author>
      <name>Laurie Tynor</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=1269229</id>
    <updated>2008-09-04T15:27:46Z</updated>
    <published>2008-09-04T15:27:46Z</published>
    <summary type="html">Thanks everyone.  I tried both ways (namespaced url params and getting the original query string), and both worked!&lt;br /&gt;&lt;br /&gt;I really appreciate the fast help!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Laurie</summary>
    <dc:creator>Laurie Tynor</dc:creator>
    <dc:date>2008-09-04T15:27:46Z</dc:date>
  </entry>
  <entry>
    <title>RE: Url GET parameters in portlet java code</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=1267039" />
    <author>
      <name>Radu B</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=1267039</id>
    <updated>2008-09-04T07:46:32Z</updated>
    <published>2008-09-04T07:46:32Z</published>
    <summary type="html">The workaround that was OK for me was to call:&lt;br /&gt;&lt;br /&gt;String queryString = (String)renderRequest.getAttribute(&amp;#34;javax.servlet.forward.query_string&amp;#34;); &lt;br /&gt;&lt;br /&gt;which is giving back the original query string that you can parse with StringTokenizer for instance.&lt;br /&gt;&lt;br /&gt;I am now using FriendlyURL for my portlet. If the portlet is not multiple-instance, the URL will look like&lt;br /&gt;&lt;em&gt;http://server-name/page&lt;/em&gt;/-/FriendlyName/ParameterName/ParameterValue&lt;br /&gt;&lt;br /&gt;which is more nice and SEO friendly than QueryString with portlet  namespace</summary>
    <dc:creator>Radu B</dc:creator>
    <dc:date>2008-09-04T07:46:32Z</dc:date>
  </entry>
  <entry>
    <title>RE: Re: [Liferay Forums][3. Development] Url GET parameters in portlet java</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=1267012" />
    <author>
      <name>Tobias Amon</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=1267012</id>
    <updated>2008-09-04T07:35:18Z</updated>
    <published>2008-09-04T07:35:18Z</published>
    <summary type="html">Hello,&lt;br /&gt;&lt;br /&gt;you can only get the parameter values if the parameters were addressed to the portlet where you have your code.&lt;br /&gt;This is difficult as you need to have the instance id of a portlet to be able to attach a parameter to it.&lt;br /&gt;&lt;br /&gt;What I do to achive this is to set the portlet where you want to get the param to &amp;#34;not instanceable&amp;#34; this means that the ID of the portlet follows a given structure. Addressing a portlet is then easy as you only need this fix instance id. Here is an example:&lt;br /&gt;     http://localhost:8080/web/guest/home?p_p_id=test_WAR_mytestwar&amp;amp;p_p_action=0&amp;amp;myparam=myvalue&lt;br /&gt;Inside the portlet called &amp;#34;test&amp;#34; packaged in a war file called my_test_war.war you can get the values.&lt;br /&gt;&lt;br /&gt;Optionally as Ray already said you can use the Portlet 2.0 features (but only in Liferay 5)</summary>
    <dc:creator>Tobias Amon</dc:creator>
    <dc:date>2008-09-04T07:35:18Z</dc:date>
  </entry>
  <entry>
    <title>Re: [Liferay Forums][3. Development] Url GET parameters in portlet java cod</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=1266407" />
    <author>
      <name>Ray Augé</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=1266407</id>
    <updated>2008-09-04T03:33:27Z</updated>
    <published>2008-09-04T03:33:27Z</published>
    <summary type="html">I&amp;#39;m not sure about JSF in particular, but the params DO have to be&lt;br /&gt;portlet namespaced, which is probably why they are working from a POST&lt;br /&gt;(because the jsf-portlet framework is namespaceing them for you).&lt;br /&gt;&lt;br /&gt;This will normally look like: [tt]_PORTLET_ID_key=20[/tt].&lt;br /&gt;&lt;br /&gt;If you don&amp;#39;t want that namespacing (which is required by all portlets),&lt;br /&gt;then you need to look at the JSR-286 feature called &amp;#34;public render&lt;br /&gt;parameters&amp;#34; which allows you to globally define params which are&lt;br /&gt;accessed using such an un-namespaced pattern. &lt;br /&gt;&lt;br /&gt;This feature also allows for IPC if more than one portlet are configured&lt;br /&gt;to handle the same public parameter, but this is not expressly required.&lt;br /&gt;&lt;br /&gt;HTH!</summary>
    <dc:creator>Ray Augé</dc:creator>
    <dc:date>2008-09-04T03:33:27Z</dc:date>
  </entry>
  <entry>
    <title>Url GET parameters in portlet java code</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=1266386" />
    <author>
      <name>Laurie Tynor</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=1266386</id>
    <updated>2008-09-04T03:23:36Z</updated>
    <published>2008-09-04T03:23:36Z</published>
    <summary type="html">I&amp;#39;m trying to retrieve the GET url parameters from inside of a portlet.   I&amp;#39;m using liferay 4.4.2, with jsf and the MyFacesGenericPortlet and inside of one of my backing beans I&amp;#39;ve tried the following:  &lt;br /&gt;&lt;br /&gt;1. ((PortletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getParameter(KEY);&lt;br /&gt;2. ((RenderRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getParameter(KEY);&lt;br /&gt;3. ((PortletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getAttribute(KEY);&lt;br /&gt;4. ((RenderRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getAttribute(KEY);&lt;br /&gt;5. PortalUtil.getHttpServletRequest( &lt;br /&gt;        ((PortletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getParameter(KEY));&lt;br /&gt;6. PortalUtil.getHttpServletRequest( &lt;br /&gt;        ((PortletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getParameter(KEY));&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I call the portlet by entering the url in my browser:  http://&amp;lt;portal path&amp;gt;/&amp;lt;portal_page&amp;gt;?KEY=VALUE&lt;br /&gt;&lt;br /&gt;I always get null back for the GET parameter.   I have successfully used #1 above when sending a POST parameter from a JSF page using the h:inputHidden element inside an h:commandButton.   It just doesn&amp;#39;t seem to work from a GET parameter in a url.&lt;br /&gt;&lt;br /&gt;If you have any info about the proper way to get the parameter, I&amp;#39;d really appreciate it.   (I&amp;#39;ve seen one other post on the forums about this that recommended #5 above, but it doesn&amp;#39;t work for me.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Laurie Tynor</summary>
    <dc:creator>Laurie Tynor</dc:creator>
    <dc:date>2008-09-04T03:23:36Z</dc:date>
  </entry>
</feed>
