Redirecting from the Action method is easy when compare with the Redirecting from the Render Method.To Redirect from the Action method we simply use the below code.
" actionResponse.sendRedirect(PortalUtil.getLayoutURL(themeDisplay)); "
PortalUtil.getLayoutURL(themeDisplay) : example URL where you want to redirect the after the performing some action
To Redirect From the Render method the below code can be Used :-
viewTemplate="/particular page URL";
or
try {
HttpServletResponse servletResponse = PortalUtil.getHttpServletResponse(actionResponse);
PrintWriter pw;
try {
pw = servletResponse.getWriter();
pw.write(PortalUtil.getLayoutURL(themeDisplay).toString());
pw.close();
} catch (IOException e) {
e.printStackTrace();
}
}catch(Exception e) {
e.printStackTrace();
}
" actionResponse.sendRedirect(PortalUtil.getLayoutURL(themeDisplay)); "
PortalUtil.getLayoutURL(themeDisplay) : example URL where you want to redirect the after the performing some action
To Redirect From the Render method the below code can be Used :-
viewTemplate="/particular page URL";
or
try {
HttpServletResponse servletResponse = PortalUtil.getHttpServletResponse(actionResponse);
PrintWriter pw;
try {
pw = servletResponse.getWriter();
pw.write(PortalUtil.getLayoutURL(themeDisplay).toString());
pw.close();
} catch (IOException e) {
e.printStackTrace();
}
}catch(Exception e) {
e.printStackTrace();
}
No comments:
Post a Comment