Reputation: 1635
I have a login page. When the user enters valid Username and Password another page should be displayed. I check the username and password in processAction method. How can I forward to another jsp from processAction?
Upvotes: 1
Views: 3310
Reputation: 2924
you need to use like this..
String myjsp;
public void init() {
editJSP = getInitParameter("edit-jsp");
helpJSP = getInitParameter("help-jsp");
viewJSP = getInitParameter("view-jsp");
//write your jsp page name
myjsp = getInitParameter("myjsp-jsp");
}
//method to call jsp
protected void include(
String path, RenderRequest renderRequest,
RenderResponse renderResponse)
throws IOException, PortletException {
PortletRequestDispatcher portletRequestDispatcher =
getPortletContext().getRequestDispatcher(path);
if (portletRequestDispatcher == null) {
_log.error(path + " is not a valid include");
}
else {
portletRequestDispatcher.include(renderRequest, renderResponse);
}
}
//write this method call into action method
include(myjsp, request, response);
you can call using this method also....
response.setRenderParameter("jspPage", "/admin/search.jsp");
this is easy and simplest method........
Upvotes: 2