本文介绍了如何从Liferay Portlet中的URL获取参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Liferay 6中使用了像feed.jspf这样的现成Portlet的jsp:
I'm using jsp of out-of-box portlet like feed.jspf in Liferay 6:
String articleId =null; HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(renderRequest)); articleId = httpReq.getParameter("articleId");无论是在自定义portlet还是.jsp文件中,它都给出一个空值,但是它应该有一个值.
It is giving a null value whether in custom portlet or in .jsp files, but it should have a value.
推荐答案当然,您始终可以使用标准的HttpServletRequest从中检索参数.您可以通过使用PortalUtil类来获得此请求,如以下示例所示:
Sure, you can always use the standard HttpServletRequest to retrieve your parameters from. You can get this request by using the PortalUtil class, like in the following example:
HttpServletRequest request = PortalUtil.getHttpServletRequest(portletRequest); String articleId = request.getParameter("articleId");更多推荐
如何从Liferay Portlet中的URL获取参数?
发布评论