0

我创建了一个类似的表格;

<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 request, ActionResponse response) 方法中,如何根据 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
 }
4

1 回答 1

0

用这个

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

PortalUtil.getCurrentCompleteURL();

参考链接有很多例子

于 2013-08-30T21:40:09.813 回答