양식에서 사용자 이름을 사용하고 양식 제출 후 동일한 포틀릿에서 메시지 환영을 표시하는 포틀릿을 생성하고있다. 이를 위해 render 메소드에서 params를 사용했습니다.Liferay의 Spring MVC 포틀릿에서 다중 렌더링 및 동작 메소드
참고 : liferay 6.2와 함께 spring-MVC를 사용하고 있습니다.
문제는 내가 이름을 제출할 때 다른 렌더링 메서드를 호출하는 대신 동일한 페이지로 리디렉션된다는 것입니다. 여기
내을 View.jsp입니다 :<portlet:actionURL var="actionOneMethodURL">
<portlet:param name="action" value="getUserName">
</portlet:param>
</portlet:actionURL>
<form action="${actionOneMethodURL}" method="post">
Enter Your Name:
<input type="text" name="userName" />
<input type="submit" value="OK!" />
</form>
여기 컨트롤러 코드 :
public class PortletController implements Controller {
private static final String WELCOME_PAGE = "welcomeUser";
public void handleActionRequest(ActionRequest request,
ActionResponse response) throws Exception {
}
@ActionMapping(params = "action=getUserName")
public void actionOneMethod(ModelMap model, ActionRequest request,
ActionResponse response) {
String userName = request.getParameter("userName");
model.addAttribute("userName", userName);
response.setRenderParameter("action", "displayName");
}
@RenderMapping
public ModelAndView handleRenderRequest(RenderRequest request,
RenderResponse response) throws Exception {
Map<String, Object> model = new HashMap<String, Object>();
model.put("helloWorldMessage", "Hello There!");
return new ModelAndView("helloWorld", model);
}
@RenderMapping(params = "action=displayName")
public String displayName(ModelMap model, RenderRequest request,
RenderResponse response) throws Exception {
return WELCOME_PAGE;
}
}
누군가가 도와 드릴까요?
편집 : 이것은 모든 XML 파일로 인해 발생할 수 있습니까 ?? 만약 그렇다면 어느 것입니까?
이 경우에는 문제가되지 않습니다. param 이름 "action"을 사용하여 리디렉션하면 좋습니다. 여러 번 사용했습니다. – tomic