0

I want to get parameter from URL and set it as value to hidden input. I tried it like I did when I used Servlet API. It doesn't work. (value=0). Also I checked this answer. And nothing helped. Also I tried to use scriptlets <input type="hidden" name="views" value="<%PortalUtil.getOriginalServletRequest(request).getParameter("views").toString();%>">

But it doesn't work too. How to extract it in liferay7 portlet and set to input?

Serg Shapoval
  • 707
  • 1
  • 11
  • 39

3 Answers3

1
HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(renderRequest));
String abc = httpReq.getParameter("abc");

As stated at https://web.liferay.com/community/forums/-/message_boards/message/9784835

yılmaz
  • 1,818
  • 13
  • 15
0

You can try to use ParamUtil. Hope this will help.

String myUserName = ParamUtil.getString(request, "views");
nikita_pavlenko
  • 658
  • 3
  • 11
0

You should create renderURL with your parameter, smth like that:

<portlet:renderURL var="anyNameYouWantUrl" copyCurrentRenderParameters="true"> <portlet:param name="anyName" value="anyValue"/> </portlet:renderURL>

--

copyCurrentRenderParameters="true" will save your render parameter and you can easily set it to hidden input using action method.

Al.Boldyrev
  • 486
  • 7
  • 30