URL session variables problems

I don't know why the values (BegDate, EndDate) are still null after I click an URL link althought I did set up session varaibles. Here is the major portion of my Code. Hope you can help me find out the problem.

in view.jsp ( this is first page)

<div class="portlet-generic-container" style="padding-top:5px;padding-bottom:5px;">

<label>Date Range: <input type="text" size="20" maxlength="30" name= "BegDate" value="<%=in_format.format(cal.getTime())%>" > - <input type="text" size="20" maxlength="30" name="EndDate" value=<%=s%> > ( enter as mm/dd/yyyy)</label>

</div

In view2.jsp ( this is page from view.jsp submit button ) I can have the BegDate and EndDate values passed successfully from view.jsp user input.

><%

HttpSession session = request.getSession ();

//String MyBegDate = session.getAttribute ( "BegDate" ) ;

//String MyEndDate = session.getAttribute ( "EndDate" ) ;

session.setAttribute ( "BegDate", MyBegDate ) ;

session.setAttribute ( "EndDate", MyEndDate ) ;

%>

<div class="portlet-generic-container" style="padding-top:5px;padding-bottom:5px;">

<label>Start Date: <input type="text" size="20" maxlength="30" name= "BegDate" value="<%=MyBegDate%>"/> -

<label>End Date: <input type="text" size="20" maxlength="30" name="EndDate" value="<%=MyEndDate%>"/></label>

The output is a list of IP address with an URL link under each. The IP link will trigger to another page called "IPByHourPage.jsp.

In IPByHourPage.jsp When cicking onto IpHourPage, the BegDate and EndDate all dispalyed null values. It seems the session doesn't work

<%

HttpSession session = request.getSession ();

String MyBegDate = request.getParameter("BegDate");

String MyEndDate = request.getParameter("EndDate");

session.setAttribute ( "BegDate", MyBegDate ) ;

session.setAttribute ( "EndDate", MyEndDate ) ;

System.out.println("BegDate from hourly " + MyBegDate);

System.out.println("Endate from hourly " + MyEndDate);

%>

<label>Start Date: <input type="text" size="20" maxlength="30" value="<%=MyBegDate%>"/> -

<label>End Date: <input type="text" size="20" maxlength="30" value="<%=MyEndDate%>"/></label>

In NFD.java here is the doview method

protected void doView(RenderRequest request, RenderResponse response)

throws PortletException, IOException, UnavailableException {

response.setContentType("text/html");

PortletSession session = request.getPortletSession();

String MyBegDate = request.getParameter( "BegDate" ) ;

String MyEndDate = request.getParameter ( "EndDate" ) ;

String MyNetworks = request.getParameter("networks");

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") )

{

session.setAttribute("BegDate", MyBegDate);

session.setAttribute("EndDate", MyEndDate);

PortletRequestDispatcher kk = getPortletContext().getRequestDispatcher("/view2.jsp");

kk.include(request, response);

}

if (MyIPHourAction != null && MyIPHourAction.equals("Ret_IPByHourPage"))

{

session.setAttribute("BegDate", MyBegDate);

session.setAttribute("EndDate", MyEndDate);

PortletRequestDispatcher mm = getPortletContext().getRequestDispatcher("/view2.jsp");

mm.include(request, response);

}

if (GotoRenderAction != null && GotoRenderAction.equals("IpByHourPage"))

{

session.setAttribute("BegDate", MyBegDate);

session.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 )

{

session.setAttribute("BegDate", MyBegDate);

session.setAttribute("EndDate", MyEndDate);

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);

}

else if (MyEndDate==null )

{

PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/view.jsp");

prd.include(request, response);

}

}

Please help me why my session doesn't work?

[5046 byte] By [wasabi3689a] at [2007-11-26 20:57:50]
# 1
It's quite possible your session does work. If request.getParameter("BegDate") returns null then you would be putting null into the session. Since you are getting null from the session, it's possible that is happening.
DrClapa at 2007-7-10 2:27:22 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
The problem is when I l click an URL to another page, another page cannot have the same values from the previous page. I don't know how to fix. Can you help my code above.
wasabi3689a at 2007-7-10 2:27:22 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...