| roys@mainsoft.com 2007-12-25, 1:25 pm |
| I would do the following:<br />
<ul>
<li>In the first JSP set the form's action attribute to portlet action url with a parameter that indicated to navigate to the other jsp. For example: </li>
</ul>
<form name="<portlet:namespace/>myForm" method="post" action="<portlet:actionURL><portlet:param name="goto" value="view2.jsp"/></portlet:actionURL>"><br />
<ul>
<li>In the portlet's processAction method read the parameter and set a render parameter. For example:</li>
</ul>
public void processAction(ActionRequest req, ActionResponse res) throws ... {<br />
String page = req.getParameter("goto");<br />
//perform business logic if necessary<br />
res.setRenderParameter("goto",page);<br />
}<br />
<ul>
<li>Add a dispatching code in the doView method:</li>
</ul>
public void doView(RenderRequest request,RenderResponse response) throws ... {<br />
String gotopage = request.getParameter("goto");<br />
response.setContentType("text/html");<br />
if (gotopage != null)<br />
{<br />
PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/" + gotopage);<br />
rd.include(request,response); <br />
}<br />
else <br />
{<br />
PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/view1.jsp");<br />
rd.include(request,response); <br />
}<br />
} <br />
<br />
Roy
|