如何从Portlet类中的processAction()方法中识别表单操作URI?

时间:2013-08-30 09:29:17

标签: java liferay portlet liferay-6

我创建了一个像

这样的表单
<portlet:actionURL var="myFriendlyURI">  
<portlet:param name="action" value="addUser"></portlet:param>  
</portlet:actionURL>  

<form id="userForm" name="userForm" action="${myFriendlyURI}" method="post">  

 Name :- <input type="text" name="userName">  

 <input type="submit">  
</form> 

在processAction(ActionRequest请求,ActionResponse响应)方法中,如何根据myFriendlyURI识别请求URI?

request.getAttribute("javax.servlet.forward.request_uri").toString()) is giving only "/web/portal/Adduser-PageName".

我只想像在Servlet类中一样检查请求;

if(request.getRequestURI().endsWith("user/add")) { // <form action="user/add" ..... >
    System.out.println("Ends with :  user/add ");
    // do actions here
 }

1 个答案:

答案 0 :(得分:0)

使用此

HttpServletRequest convertReq = PortalUtil.getHttpServletRequest(actionRequest);
HttpServletRequest originalReq = PortalUtil.getOriginalServletRequest(actionRequest);

PortalUtil.getCurrentCompleteURL();

对链接的引用有很多例子