How to catch and display a link content in another portlet page?
Can you tell me how to display a URL content into next page after an user click s on this link? I am developing a JSR 168 portlet under a Portal. I have 3 pages so far in my portlet. view.jsp, view2.jsp and IpByHourPage.jsp. view2.jsp displays a lis of IP address. When an user clicks on an IP in view2.jsp, it goes to IpByHourPage.jsp. How to catch the IP address such as 123.23.89.21 that an user just click displayed in IpByHourPage.jsp. I don't know why I got null value returned.
Also, I don't know how to do a "go back to previous page". I want to go back to view2.jsp from IpbyHourPage.jsp
Here is my code
in view2.jsp
.....
<portlet:renderURL var="aURL">
<portlet:param name="goto" value="IpByHourPage"/>
</portlet:renderURL>
<a href="<%=aURL.toString() %>" ><%=MyIP%></a>
.........
in IpByHourPage.jsp
..........
<%
String MyIPHour = request.getParameter("goto");
%>
<h1>IP Report by Hour ( <%=MyIPHour%> )</h1>
...........
<portlet:renderURL var="Ret_IPByHour">
<portlet:param name="Ret_IPHourPage" value="Ret_IPByHourPage"/>
</portlet:renderURL>
.........
<center> <a href="<%=Ret_IPByHour.toString() %>" ><b>Choose Another IP</b></a></center>
in my .java file
........
protected void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException, UnavailableException {
response.setContentType("text/html");
String MyBegDate = request.getParameter("BegDate");
String MyEndDate = request.getParameter("EndDate");
String MyNetworks = request.getParameter("networks");
String MyYourName = request.getParameter("yourname");
PortletURL renderURL = response.createRenderURL();
renderURL.setPortletMode(PortletMode.VIEW);
request.setAttribute("renderURL", renderURL.toString() )
String GotoRenderAction = request.getParameter("goto");
String MyIPHourAction = request.getParameter("Ret_IPHourPage");
if ( (MyIPHourAction!=null) && MyIPHourAction.equals("Ret_IPByHourPage") )
{
PortletRequestDispatcher kk = getPortletContext().getRequestDispatcher("/view2.jsp");
kk.include(request, response);
}
if (MyIPHourAction != null && MyIPHourAction.equals("Ret_IPByHourPage"))
{
PortletRequestDispatcher mm = getPortletContext().getRequestDispatcher("/view2.jsp");
mm.include(request, response);
}
if (GotoRenderAction != null && GotoRenderAction.equals("IpByHourPage"))
{
request.setAttribute("BegDate", "MyBegDate");
request.setAttribute("EndDate", "MyEndDate");
System.out.println("BegDate" + MyBegDate);
System.out.println("Endate" + MyEndDate);
PortletRequestDispatcher mm = getPortletContext().getRequestDispatcher("/IpByHourPage.jsp");
mm.include(request, response);
}
if(MyEndDate!= null )
{
PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/view2.jsp");
prd.include(request, response);
}
else if (MyEndDate==null && GotoRenderAction == null)
{
PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/view.jsp");
prd.include(request, response);
}
}
The problem for above code is the clicked single IP can not be displayed in IpByHourPage.jsp. and I cannot go back to view2.jsp from IpByHourPage.jsp. when I click "Choose Another IP"
I find out that the MyBegDate and MyEndDate values are all null when I click Choose Another IP link. I got the following error message
Caused by: javax.servlet.ServletException: Unparseable date: "null null"
at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl .java:858)
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.j ava:791)
at org.apache.jsp.view2_jsp._jspService(view2_jsp.java:651)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
How to fix above problems. Thanks

