<?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>Liferay ajax request, Cannot get parameter at serveResource method</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=59796123" />
  <subtitle>Liferay ajax request, Cannot get parameter at serveResource method</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=59796123</id>
  <updated>2026-04-05T18:36:52Z</updated>
  <dc:date>2026-04-05T18:36:52Z</dc:date>
  <entry>
    <title>RE: Liferay ajax request, Cannot get parameter at serveResource method</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111324050" />
    <author>
      <name>Marco Azzalini</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111324050</id>
    <updated>2018-10-25T13:41:09Z</updated>
    <published>2018-10-25T13:41:09Z</published>
    <summary type="html">&lt;blockquote&gt;Rahul Panchivalahii Gurumurthy Godlaveet,&lt;br /&gt; Thanks for the reply, i follow your steps but i didn&amp;#39;t succeeded,&lt;br /&gt; i applied below code&lt;br /&gt;&lt;br /&gt;                        var getHospitalId = portletNameSpace+&amp;#34;getHospitalId&amp;#34;;&lt;br /&gt;			var getHospitalistId = portletNameSpace+&amp;#34;getHospitalistId&amp;#34;;&lt;br /&gt;			var getCalendarProfile = portletNameSpace+&amp;#34;getCalendarProfile&amp;#34;;&lt;br /&gt;			var getCheckedList = portletNameSpace+&amp;#34;getCheckedList&amp;#34;;&lt;br /&gt;			&lt;br /&gt;			A.io.request(portletResourceURL,{&lt;br /&gt;				dataType: &amp;#39;json&amp;#39;,&lt;br /&gt;				data:{	&lt;br /&gt;						getHospitalId : hospitalId,&lt;br /&gt;						getHospitalistId : hospitalistId,&lt;br /&gt;						getCalendarProfile : calendarProfile,&lt;br /&gt;						getCheckedList : checkedList&lt;br /&gt;					}&lt;/blockquote&gt;Hi Rahul, long time has passed since your post :-)&lt;br /&gt;I found myself in your same situation so I can add a little note that could help someone else.&lt;br /&gt;Your code would work as is, provided one change the &amp;#39;data type&amp;#39; value to  &amp;#39;text/html&amp;#39; instead of &amp;#39;json&amp;#39;. In this way ParamUtil.getXXXX methods will work as expected in the java code.</summary>
    <dc:creator>Marco Azzalini</dc:creator>
    <dc:date>2018-10-25T13:41:09Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay ajax request, Cannot get parameter at serveResource method</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60280206" />
    <author>
      <name>Sushil Patidar</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60280206</id>
    <updated>2015-10-03T10:56:27Z</updated>
    <published>2015-10-03T10:56:27Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Hi,&lt;br&gt;&lt;br&gt;To get request parameters through ajax request ,. you need to set following property in &lt;strong&gt;liferay-portlet.xml&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;&amp;lt;requires-namespaced-parameters&amp;gt;false&amp;lt;/requires-namespaced-parameters&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;Regards&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Sushil Patidar</dc:creator>
    <dc:date>2015-10-03T10:56:27Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay ajax request, Cannot get parameter at serveResource method</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60276874" />
    <author>
      <name>Rahul Panchivala</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60276874</id>
    <updated>2015-10-03T07:52:00Z</updated>
    <published>2015-10-03T07:52:00Z</published>
    <summary type="html">hii Gurumurthy Godlaveet,&lt;br /&gt; Thanks for the reply, i follow your steps but i didn&amp;#39;t succeeded,&lt;br /&gt; i applied below code&lt;br /&gt;&lt;br /&gt;                        var getHospitalId = portletNameSpace+&amp;#34;getHospitalId&amp;#34;;&lt;br /&gt;			var getHospitalistId = portletNameSpace+&amp;#34;getHospitalistId&amp;#34;;&lt;br /&gt;			var getCalendarProfile = portletNameSpace+&amp;#34;getCalendarProfile&amp;#34;;&lt;br /&gt;			var getCheckedList = portletNameSpace+&amp;#34;getCheckedList&amp;#34;;&lt;br /&gt;			&lt;br /&gt;			A.io.request(portletResourceURL,{&lt;br /&gt;				dataType: &amp;#39;json&amp;#39;,&lt;br /&gt;				data:{	&lt;br /&gt;						getHospitalId : hospitalId,&lt;br /&gt;						getHospitalistId : hospitalistId,&lt;br /&gt;						getCalendarProfile : calendarProfile,&lt;br /&gt;						getCheckedList : checkedList&lt;br /&gt;					}</summary>
    <dc:creator>Rahul Panchivala</dc:creator>
    <dc:date>2015-10-03T07:52:00Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay ajax request, Cannot get parameter at serveResource method</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60106165" />
    <author>
      <name>Gurumurthy Godlaveeti</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=60106165</id>
    <updated>2015-09-30T06:50:48Z</updated>
    <published>2015-09-30T06:50:48Z</published>
    <summary type="html">Hi Rahul,&lt;br /&gt;&lt;br /&gt;After seeing your code, i would like to give two suggestions here.&lt;br /&gt;&lt;br /&gt;1) Print all variables data in JS before adding to ajax request.&lt;br /&gt;2) The data section will have data in key:value format. The key is your own name &amp;amp; the value is static value or JS variable names.&lt;br /&gt;You must use key names in serveResource() method for getting right values.&lt;br /&gt;&lt;br /&gt;You have JS variable names something like getHospitalId but inside data section, its different.&lt;br /&gt;&lt;br /&gt;better to use like below.&lt;br /&gt;&lt;br /&gt;data{&lt;br /&gt;getHospitalId : getHospitalId ,&lt;br /&gt;getHospitalistId : getHospitalistId ,&lt;br /&gt;getCalendarProfile : getCalendarProfile ,&lt;br /&gt;getCheckedList : getCheckedList &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;This time, it will give your values in serveResource method also.&lt;br /&gt;&lt;br /&gt;Don&amp;#39;t forget to check values of those parameters before adding to ajax request.&lt;br /&gt;&lt;br /&gt;Thanks&lt;br /&gt;Guru</summary>
    <dc:creator>Gurumurthy Godlaveeti</dc:creator>
    <dc:date>2015-09-30T06:50:48Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay ajax request, Cannot get parameter at serveResource method</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=59852033" />
    <author>
      <name>David H Nebinger</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=59852033</id>
    <updated>2015-09-25T05:56:53Z</updated>
    <published>2015-09-25T05:56:53Z</published>
    <summary type="html">If possible, don&amp;#39;t use ids at all.  Decorate with custom classes and use the class selector to access elements.  Doesn&amp;#39;t help with the issue if you have instanceable portlets, but it&amp;#39;s better than working with the ids.</summary>
    <dc:creator>David H Nebinger</dc:creator>
    <dc:date>2015-09-25T05:56:53Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay ajax request, Cannot get parameter at serveResource method</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=59852398" />
    <author>
      <name>Rahul Panchivala</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=59852398</id>
    <updated>2015-09-25T05:11:26Z</updated>
    <published>2015-09-25T05:11:26Z</published>
    <summary type="html">Hii David H Nebinger,&lt;br /&gt;&lt;br /&gt;Thanks for the reply David, &lt;br /&gt;Do u have any suggetion for me how to apply namespace before bold text below..&lt;br /&gt;data:{&lt;br /&gt;                &lt;strong&gt;getHospitalId&lt;/strong&gt; : hospitalId,&lt;br /&gt;                &lt;strong&gt;getHospitalistId&lt;/strong&gt; : hospitalistId,&lt;br /&gt;                &lt;strong&gt;getCalendarProfile&lt;/strong&gt; : calendarProfile,&lt;br /&gt;                &lt;strong&gt;getCheckedList&lt;/strong&gt; : checkedList&lt;br /&gt;}</summary>
    <dc:creator>Rahul Panchivala</dc:creator>
    <dc:date>2015-09-25T05:11:26Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay ajax request, Cannot get parameter at serveResource method</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=59852346" />
    <author>
      <name>Rahul Panchivala</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=59852346</id>
    <updated>2015-09-25T05:04:40Z</updated>
    <published>2015-09-25T05:04:40Z</published>
    <summary type="html">Hi siddhant jain,&lt;br /&gt;&lt;br /&gt;Thanks for the reply,&lt;br /&gt;I had already applied this solutions but  however i have no results.</summary>
    <dc:creator>Rahul Panchivala</dc:creator>
    <dc:date>2015-09-25T05:04:40Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay ajax request, Cannot get parameter at serveResource method</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=59811072" />
    <author>
      <name>David H Nebinger</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=59811072</id>
    <updated>2015-09-24T15:34:55Z</updated>
    <published>2015-09-24T15:34:55Z</published>
    <summary type="html">Namespace doesn&amp;#39;t work like that Rahul.&lt;br /&gt;&lt;br /&gt;When you namespace an input field, the natural name is decorated with instance information so there is no DOM name collisions.&lt;br /&gt;&lt;br /&gt;if you have two of your portlet on a page, then the &amp;lt;input type=&amp;#34;hidden&amp;#34; id=&amp;#34;portletNameSpace&amp;#34; value=&amp;#34;&amp;lt;portlet:namespace/&amp;gt;&amp;#34;/&amp;gt; concept fails as you cannot get a unique DOM element when you search by id so your value would end up being wrong.&lt;br /&gt;&lt;br /&gt;Your inputs must be namespaced to guarantee uniqueness and also to provide visibility on the portlet (the portal filters out any parameters that are not namespaced from list in the PortletRequest, and it also trims the namespace prefix off so your code doesn&amp;#39;t have to worry about it).&lt;br /&gt;&lt;br /&gt;So you&amp;#39;re submitting a request with param portletNameSpace, but because it is not namespaced it doesn&amp;#39;t get fed to the portlet&amp;#39;s serveResource method.</summary>
    <dc:creator>David H Nebinger</dc:creator>
    <dc:date>2015-09-24T15:34:55Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay ajax request, Cannot get parameter at serveResource method</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=59804912" />
    <author>
      <name>siddhant jain</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=59804912</id>
    <updated>2015-09-24T13:42:28Z</updated>
    <published>2015-09-24T13:42:28Z</published>
    <summary type="html">Hi Rahul,&lt;br /&gt;&lt;br /&gt;you can go through these links on how to ajax in liferay:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://stackoverflow.com/questions/27783552/ajax-on-liferay-portlets"&gt;link1&lt;/a&gt;.&lt;br /&gt;&lt;a href="http://blog.xceptiontech.com/2015/05/send-some-data-to-serveresource-method.html"&gt;link2&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Thanks&lt;br /&gt;Siddhant</summary>
    <dc:creator>siddhant jain</dc:creator>
    <dc:date>2015-09-24T13:42:28Z</dc:date>
  </entry>
  <entry>
    <title>Liferay ajax request, Cannot get parameter at serveResource method</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=59796122" />
    <author>
      <name>Rahul Panchivala</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=59796122</id>
    <updated>2015-09-24T12:37:42Z</updated>
    <published>2015-09-24T12:37:42Z</published>
    <summary type="html">Hi all,&lt;br /&gt;&lt;br /&gt;I have trouble in getting parameter in serveResource method ,&lt;br /&gt;My scenario is : I have one view.jsp page and one separate abc.js file&lt;br /&gt;I got portletNamespace and resourceURL  by setting &lt;br /&gt;&amp;lt;input type=&amp;#34;hidden&amp;#34; id=&amp;#34;portletNameSpace&amp;#34; value=&amp;#34;&amp;lt;portlet:namespace/&amp;gt;&amp;#34;/&amp;gt;&lt;br /&gt;&amp;lt;input type=&amp;#34;hidden&amp;#34; id=&amp;#34;portletResourceURL&amp;#34; value=&amp;#34;&amp;lt;portlet:resourceURL/&amp;gt;&amp;#34;/&amp;gt; &lt;br /&gt;in my view.jsp file &lt;br /&gt;and get this property into abc.js file by writing this&lt;br /&gt;var portletNameSpace=$(&amp;#39;#portletNameSpace&amp;#39;).val();&lt;br /&gt;var portletResourceURL=$(&amp;#39;#portletResourceURL&amp;#39;).val();&lt;br /&gt;&lt;br /&gt;now my problem is  :&lt;br /&gt;why am i not getting any parameter in my serveResource method&lt;br /&gt;I have below code.&lt;br /&gt;&lt;br /&gt;                 var getHospitalId = portletNameSpace+&amp;#34;getHospitalId&amp;#34;; &lt;br /&gt;		 var getHospitalistId = portletNameSpace+&amp;#34;getHospitalistId&amp;#34;;&lt;br /&gt;		 var getCalendarProfile = portletNameSpace+&amp;#34;getCalendarProfile&amp;#34;;&lt;br /&gt;		 var getCheckedList = portletNameSpace+&amp;#34;getCheckedList&amp;#34;;&lt;br /&gt;		 A.io.request(portletResourceURL,{&lt;br /&gt;				dataType: &amp;#39;json&amp;#39;,&lt;br /&gt;				data:{getHospitalId : hospitalId,&lt;br /&gt;					   getHospitalistId : hospitalistId,&lt;br /&gt;					   getCalendarProfile : calendarProfile,&lt;br /&gt;					   getCheckedList : checkedList&lt;br /&gt;                                        },&lt;br /&gt;				 method:&amp;#39;post&amp;#39;,&lt;br /&gt;				on:{&lt;br /&gt;					success: function(){}&lt;br /&gt;                                       }&lt;br /&gt;                                  });&lt;br /&gt;Note  :  I got call in serveResource method but not getting any parameters that i set in data field</summary>
    <dc:creator>Rahul Panchivala</dc:creator>
    <dc:date>2015-09-24T12:37:42Z</dc:date>
  </entry>
</feed>
