Session variable null in jsp after some hrs
Hi All,
I am facing problem with session variable in JSP. For 6/8 hours application is running fine then session variable on JSP become as null. Values of NAME_LIST are coming from database. When we are storing in DAO and Action we are getting NAME_LIST properly. But when control is forwarded to JSP, some how session variable become null and page shows blank. In console we are getting exception in JSP. Again if we restart OC4J then session is not null and I am getting all values in dropdown.
Even I tried to hardcode one name instead of displaying blank page by checking name_Lists==null still I am not getting drop down with "Name_1" after 6/8 hours. If we restart OC4J then I am not facing null problem for next 6/8 hrs.
I am using Struts 1.2.7, JDK 1.4.2 and Oracle 10g OC4J.
Please find below Code, which at start of JSP after Login into application.
<%System.out.println("#################### Before NAME_LIST Select #################");%>
<%
ArrayList name_Lists=(ArrayList)session.getAttribute("NAME_LIST");
if(name_Lists==null)
{
%>
<html:select style="width:180;" styleClass="text" property="listName" size="1">
<html:option value=""><bean:message key="N.select"/> </html:option>
<html:option value="1">Name_1</html:option>
</html:select>
<%
}
else
{%>
<html:select style="width:180;" styleClass="text" property="listName" size="1">
<%
for(int i=0;i<name_Lists.size();i++){
ArrayList name_Lists_1=(ArrayList)name_Lists.get(i);
System.out.println("#################### inside NAME_LIST #################"+(String)name_Lists_1.get(0)+(String)name_Lists_1.get(1));
%>
<html:option value="<%=(String)name_Lists_1.get(0) %>"><%=(String)name_Lists_1.get(1) %></html:option>
<%
}
%>
</html:select>
<%
}
%>
<%System.out.println("#################### After NAME_LIST Select ################");%>
Please send me Solution.
Thanks and Regards,
Kailas

