Portlet类
public class AddRoomController extends MVCPortlet {
public void doView(RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException {
System.out.println("hu to call thau chu...");
super.doView(renderRequest, renderResponse);
}
// @ProcessAction(name="addRooms") //Adding this annotation also not solving the issue
public void addRooms(ActionRequest actionRequest, ActionResponse actionResponse)
throws IOException, PortletException {
System.out.println("Called");
String locationName = actionRequest.getAttribute("locationName").toString();
System.out.println("===> "+locationName);
actionResponse.sendRedirect("addRooms.jsp");
}
}
view.jsp的
Snippet 1
<body>
<portlet:actionURL name="addRooms" var="addRoomsUrl"></portlet:actionURL>
<form action="${addRoomsUrl}" method="post">
<!-- Custom Inputs -->
</form>
</body>
Snippet 2
<body>
<portlet:actionURL name="addRooms" var="addRoomsUrl"></portlet:actionURL>
<form action="<%=addRoomsUrl%>" method="post">
<!-- Custom Inputs -->
</form>
</body>
我正在尝试使用上述两个片段调用action方法,但它们都不起作用。
在我的Portlet中调用了doView(),但是当我尝试调用processAction方法名称addRooms时,它给出了我带有null值的错误。 我想尽可能避免使用合金-ui。
任何帮助将不胜感激......
答案 0 :(得分:0)
使用以下方法解决了错误: