Java – how to get parameters from the URL in Liferay portlet?

I used something like feed in Liferay 6 JSP of out of the box portlet such as jspf:

String articleId =null;
HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(renderRequest));
articleId = httpReq.getParameter("articleId");

Whether in custom portlets or in JSP file, it gives a null value, but it should have a value

Solution

Of course, you can always use the standard HttpServletRequest to retrieve your parameters You can use the portalutil class to obtain this request, as shown in the following example:

HttpServletRequest request = PortalUtil.getHttpServletRequest(portletRequest);
String articleId = request.getParameter("articleId");
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>