Session length??

Sam Seaver <[email protected]>
Newsgroups gmane.comp.java.sun.servlet
Message-ID <[email protected]>
Dear all,

I have a JSP file that sets the session length to 0, i read somewhere that
this would mean the session would only expire when the browser window is
closed.

This same JSP file opens anather JSP file (a viewer) in a new window using
JavaScript.  However, after a few seconds, or even possibly after clicking
outside the window, the session object im using ceases to exist and i get a
null pointer exception.  here's the code:

Main JSP file:
<%
String[] jobFiles;
session.setMaxInactiveInterval(0);
%>
.........
<%
if(fileHandler.validateDir(fileHandler.getJobID())){
        fileHandler.findResults();
        jobFiles = (String[])fileHandler.getXmlFileNames();
        if(jobFiles.length != 0){
        %>
            <p><B>Results</B>
            <br/>Press a button to see the results for a chain pair in the
viewer.<br/>
            <form><table>
            <%
            for(int i = 0;i<jobFiles.length;i++){
                %>
                <tr>
                <%
                if(fileHandler.getModel()){
                %>
                <td>
                <input type="button" value="Model: <%=
fileHandler.getChMo(jobFiles[i]) %>"
                    onclick="window.open('monster/viewer.jsp?number=<%= i
%>', 'viewer', 'height=800,width=1100,dependent=1')"/>
                </td>
                <td>
                <!--
                <input type="button" value="Model: <%=
fileHandler.getChMo(jobFiles[i]) %>" onclick="window.open('monster/<%=
fileHandler.getDir() + jobFiles[i] %>', 'examples', 'width=600, height=300,
scrollbars=yes, dependent=1')" />-->
                </td>
                <%
                }else{
                %>
                <td>
                <input type="button" value="Chains: <%=
fileHandler.getChMo(jobFiles[i]) %>"
                    onclick="window.open('monster/viewer.jsp?number=<%= i
%>', 'viewer', 'height=800,width=1100,dependent=1')"/>
                </td>
                <td>
                </td>
                <%
                }
                jobFiles[i] = fileHandler.getDir() + jobFiles[i];
            }
                %>
                </tr>
                <%
            session.setAttribute("Files", jobFiles);
            %>
            </form></table>
        <jsp:getProperty name="fileHandler" property="output"/>
            <%
        }else{
        %>
        <p> No results have been found yet. Please check later.
        <br/> If it has been too long, please email the <a
href="mailto:[email protected]">webmaster</a> with the job id.
        <jsp:getProperty name="fileHandler" property="output"/>
        <%
        }
    }else{
    %>
    <br/>This job never existed. Please try again, or email the <a
href="mailto:[email protected]">webmaster</a> with the name of the file
used for the job.
    <%
    }
%>

when i click on one of the resulting buttons i open a new window with this
code:
<jsp:useBean id="fileHandler2"
class="edu.northwestern.ls.monster.UploadBean2" scope="session"/>
<%
String[] files = (String[])session.getAttribute("Files");
String file = files[Integer.parseInt(request.getParameter("number"))];
%>

<html><head><title>Results for chains: <%= fileHandler2.getChMo(file)
%></title></head>
<body>
<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width="1000" height="700"
codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0">
<param name="CODE" value="Graphica.class">
<param name="CODEBASE" value="../edu/northwestern/monster/graphica/">
<param name="type" value="application/x-java-applet;version=1.4">
<param name="file"
value="http://overhauser.ls.northwestern.edu/sam/monster/<%= file %>">
<COMMENT>
<embed type="application/x-java-applet;version=1.4"
width="1000" height="700" pluginspage="http://java.sun.com/products/plugin/"
CODE="Graphica.class" CODEBASE="../edu/northwestern/monster/graphica/"
file="http://overhauser.ls.northwestern.edu/sam/monster/<%= file %>">
<noembed>
</COMMENT>
</noembed></embed>
</object>
<center>
<BR/><B><U>NB: In order to use the print and save buttons within any
operating system, <a href=".java.policy">this file</a> must be saved in your
home directory.
<BR/>WARNING: If you understand java policy files, please edit as you feel
fit, <BR/>otherwise it is strongly recommended that you remove or rename
this file before using ANY OTHER APPLET.</B></U><BR/>
</center>
</body></html>

I get this suspicion that the session in the first page is not being relayed
into the session in the viewer page...

anyone?
S

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

___________________________________________________________________________
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.