WebSphere Portal Server - calling from one jsp to another jsp in JSR168 portlet

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Portal Server > December 2007 > calling from one jsp to another jsp in JSR168 portlet





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author calling from one jsp to another jsp in JSR168 portlet
Ragavendra

2007-12-25, 7:33 am

Hi,<br />
<br />
Iam creating one portlet called maincustomer portlet. In that two jsp pages are there one search and view jsps. After clicking submit button in first.jsp then it should goes to second.jsp<br />
<br />
But iam uanble to go the next jsp after clicking the submit button.<br />
<p />
<p />
It is showing the following error.<br />
<p />
Failed to find the resource second.jsp.......<br />
<p />
can any one help for the same.....<br />
<br />
thanks<br />
<br />
sri
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>
&lt;form name="&lt;portlet:namespace/&gt;myForm" method="post" action="&lt;portlet:actionURL&gt;&lt;portlet:param name="goto" value="view2.jsp"/&gt;&lt;/portlet:actionURL&gt;"&gt;<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
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com