开发者

Setting param from portlet URl into HttpServletRequest

开发者 https://www.devze.com 2023-03-09 00:29 出处:网络
I am referring to a url which has paramID from my portlet. The content of that paramID is handled in different portlet and it has its own controller.

I am referring to a url which has paramID from my portlet. The content of that paramID is handled in different portlet and it has its own controller.

That controller is taking HttpServletRequest to read that param.

Htt开发者_C百科pServletRequest request = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(renderRequest));
String paramID= request.getParameter("paramID");`

My param is in the url http://mysite.com?paramID=123

Will the HttpServletRequest read this param when I am calling using renderURL

<liferay-portlet:renderURL var="xyz" portletName="ABC" windowState="Normal"/>
...
<a href="xyz?pramID"> Click here</a>


Some information about render URL and such is under this question on its community wiki answer.

Also in some tutorial that is not on web I have read this kind of parameter passing is easiest done via session. Session is common for porlet and servlet so you don't have to think where the which parameter is visible and where not.


I did it with providing the param value while I invoked the renderURL

<liferay-portlet:renderURL var="xyz" portletName="ABC" windowState="Normal"/>
</liferay-portlet:renderURL>

.....

<JAVASCRIPT>
   var URL = NULL;       
   function(called){
          URL = "${xyz}&paramID=123"              //and this was read as servlet param
   }
</JAVASCRIPT>
0

精彩评论

暂无评论...
验证码 换一张
取 消