You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sarika Inamdar <si...@cisco.com> on 2003/08/06 07:15:31 UTC

Behaviour of JSP with tomcat 4.1.24

Hi All,

When we start tomcat and connect to the server, the index.jsp page is
displayed . When I key in a password, it validates the password and goes
to the next jsp page(login.jsp)

I stop tomcat and restart it again. Now when I connect to the server,
the index.jsp directly takes me to the login.jsp page without asking for
password. This should not happen. Everytime the tomcat is stopped 'n
started we should get the password validation.

But when I stop tomcat and clear the contents of
$CATALINA_HOME/work/StandAlone/,
When tomcat is started, it displays the index.jsp which asks for
password validation.

This behaviour was not seen in tomcat 3.2.3.

Please let me know if am missing something.  Am attaching the code
snippet of index.jsp and validateLogin.jsp which is called from
index.jsp

Thanks in Advance for the help,
Sarika


Here is code snippet of index.jsp :

%@ include file="header.jsp" %>
<%@ include file="validateLogin.jsp" %>

<%@ page import="com.cisco.das.core.*" %>

<b>Home</b>
<br>Host: <%= InetAddress.getLocalHost() %>
<br>Current time: <%= new Date() %>

<%
        try {
          String s = DAS.status();
          ByteArrayInputStream bs = new
ByteArrayInputStream(s.getBytes());

          Properties prop = new Properties();
          prop.load(bs);

          out.println("<br>Status: Running");

          out.println("<br>CNS name: " + prop.getProperty("name"));
          out.println("<br>CNS group: " + prop.getProperty("group",
""));

          out.println("<br>Start time: " +
                      new
Date(Long.parseLong(prop.getProperty("startTime"))
));
          out.println("<br>Version: " +
prop.getProperty("package.version"));
          out.println("<br>Build date: " +
prop.getProperty("package.date"));

          %>
          <br>
          <br>
          <form method="post" action="stop.jsp">
            <input type="submit" value="Stop process">
          </form>
          <%
        } catch (Exception e) {
         out.println("<input type=\"hidden\" name=\"debug\" value=\"" +
e.toStr
ing() + "\">");

          String configdir = System.getProperty("user.dir") + "/config";
          File pidFile = new File(configdir, "pid");
          if (pidFile.exists()) {
            out.println("<br>Status: Initializing...");
            %>
            <br>
            <form method="post" action="stop.jsp">
              <input type="submit" value="Stop Process">
            </form>
            <%
          }
          else {
            out.println("<br>Status: Stopped");
            %>
            <br>
            <form method="post" action="start.jsp">
              <input type="submit" value="Start process">
            </form>
            <%
          }
        }
%>

<%@ include file="footer.jsp" %>

Snippet of  validateLogin.jsp :

<%
    String value = (String)session.getValue("das.login");
    if (value == null) {
%>
Login password:
<form method="post" action="login.jsp?url=<%= request.getServletPath()
%>" name=
"login">
    <input type="password" size="20" name="password">
    <input type="submit" value="submit">
</form>
<%
        return;
    }
%>


Re: Behaviour of JSP with tomcat 4.1.24

Posted by John Turner <to...@johnturner.com>.
AFAIK, Tomcat saves sessions across restarts.  One of the gurus may have 
the specific answer as to how you can disable this, I believe it has 
something to do with whether your session attributes are serializable or 
not.

You can just clear out the work directory between restarts.  My shutdown 
scripts have a "rm -rf $CATALINA_HOME/work/*" in them so that it is done 
automatically.  This can cause a slow startup, since Tomcat has to 
recompile JSP again when they are accessed, but I restart Tomcat so 
rarely (maybe 2-3 times a year) that it really doesn't affect my 
instances all that much.

John

Sarika Inamdar wrote:

> Hi All,
> 
> When we start tomcat and connect to the server, the index.jsp page is
> displayed . When I key in a password, it validates the password and goes
> to the next jsp page(login.jsp)
> 
> I stop tomcat and restart it again. Now when I connect to the server,
> the index.jsp directly takes me to the login.jsp page without asking for
> password. This should not happen. Everytime the tomcat is stopped 'n
> started we should get the password validation.
> 
> But when I stop tomcat and clear the contents of
> $CATALINA_HOME/work/StandAlone/,
> When tomcat is started, it displays the index.jsp which asks for
> password validation.
> 
> This behaviour was not seen in tomcat 3.2.3.
> 
> Please let me know if am missing something.  Am attaching the code
> snippet of index.jsp and validateLogin.jsp which is called from
> index.jsp
> 
> Thanks in Advance for the help,
> Sarika
> 
> 
> Here is code snippet of index.jsp :
> 
> %@ include file="header.jsp" %>
> <%@ include file="validateLogin.jsp" %>
> 
> <%@ page import="com.cisco.das.core.*" %>
> 
> <b>Home</b>
> <br>Host: <%= InetAddress.getLocalHost() %>
> <br>Current time: <%= new Date() %>
> 
> <%
>         try {
>           String s = DAS.status();
>           ByteArrayInputStream bs = new
> ByteArrayInputStream(s.getBytes());
> 
>           Properties prop = new Properties();
>           prop.load(bs);
> 
>           out.println("<br>Status: Running");
> 
>           out.println("<br>CNS name: " + prop.getProperty("name"));
>           out.println("<br>CNS group: " + prop.getProperty("group",
> ""));
> 
>           out.println("<br>Start time: " +
>                       new
> Date(Long.parseLong(prop.getProperty("startTime"))
> ));
>           out.println("<br>Version: " +
> prop.getProperty("package.version"));
>           out.println("<br>Build date: " +
> prop.getProperty("package.date"));
> 
>           %>
>           <br>
>           <br>
>           <form method="post" action="stop.jsp">
>             <input type="submit" value="Stop process">
>           </form>
>           <%
>         } catch (Exception e) {
>          out.println("<input type=\"hidden\" name=\"debug\" value=\"" +
> e.toStr
> ing() + "\">");
> 
>           String configdir = System.getProperty("user.dir") + "/config";
>           File pidFile = new File(configdir, "pid");
>           if (pidFile.exists()) {
>             out.println("<br>Status: Initializing...");
>             %>
>             <br>
>             <form method="post" action="stop.jsp">
>               <input type="submit" value="Stop Process">
>             </form>
>             <%
>           }
>           else {
>             out.println("<br>Status: Stopped");
>             %>
>             <br>
>             <form method="post" action="start.jsp">
>               <input type="submit" value="Start process">
>             </form>
>             <%
>           }
>         }
> %>
> 
> <%@ include file="footer.jsp" %>
> 
> Snippet of  validateLogin.jsp :
> 
> <%
>     String value = (String)session.getValue("das.login");
>     if (value == null) {
> %>
> Login password:
> <form method="post" action="login.jsp?url=<%= request.getServletPath()
> %>" name=
> "login">
>     <input type="password" size="20" name="password">
>     <input type="submit" value="submit">
> </form>
> <%
>         return;
>     }
> %>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 



Re: Behaviour of JSP with tomcat 4.1.24

Posted by John Turner <to...@johnturner.com>.
AFAIK, Tomcat saves sessions across restarts.  One of the gurus may have 
the specific answer as to how you can disable this, I believe it has 
something to do with whether your session attributes are serializable or 
not.

You can just clear out the work directory between restarts.  My shutdown 
scripts have a "rm -rf $CATALINA_HOME/work/*" in them so that it is done 
automatically.  This can cause a slow startup, since Tomcat has to 
recompile JSP again when they are accessed, but I restart Tomcat so 
rarely (maybe 2-3 times a year) that it really doesn't affect my 
instances all that much.

John

Sarika Inamdar wrote:

> Hi All,
> 
> When we start tomcat and connect to the server, the index.jsp page is
> displayed . When I key in a password, it validates the password and goes
> to the next jsp page(login.jsp)
> 
> I stop tomcat and restart it again. Now when I connect to the server,
> the index.jsp directly takes me to the login.jsp page without asking for
> password. This should not happen. Everytime the tomcat is stopped 'n
> started we should get the password validation.
> 
> But when I stop tomcat and clear the contents of
> $CATALINA_HOME/work/StandAlone/,
> When tomcat is started, it displays the index.jsp which asks for
> password validation.
> 
> This behaviour was not seen in tomcat 3.2.3.
> 
> Please let me know if am missing something.  Am attaching the code
> snippet of index.jsp and validateLogin.jsp which is called from
> index.jsp
> 
> Thanks in Advance for the help,
> Sarika
> 
> 
> Here is code snippet of index.jsp :
> 
> %@ include file="header.jsp" %>
> <%@ include file="validateLogin.jsp" %>
> 
> <%@ page import="com.cisco.das.core.*" %>
> 
> <b>Home</b>
> <br>Host: <%= InetAddress.getLocalHost() %>
> <br>Current time: <%= new Date() %>
> 
> <%
>         try {
>           String s = DAS.status();
>           ByteArrayInputStream bs = new
> ByteArrayInputStream(s.getBytes());
> 
>           Properties prop = new Properties();
>           prop.load(bs);
> 
>           out.println("<br>Status: Running");
> 
>           out.println("<br>CNS name: " + prop.getProperty("name"));
>           out.println("<br>CNS group: " + prop.getProperty("group",
> ""));
> 
>           out.println("<br>Start time: " +
>                       new
> Date(Long.parseLong(prop.getProperty("startTime"))
> ));
>           out.println("<br>Version: " +
> prop.getProperty("package.version"));
>           out.println("<br>Build date: " +
> prop.getProperty("package.date"));
> 
>           %>
>           <br>
>           <br>
>           <form method="post" action="stop.jsp">
>             <input type="submit" value="Stop process">
>           </form>
>           <%
>         } catch (Exception e) {
>          out.println("<input type=\"hidden\" name=\"debug\" value=\"" +
> e.toStr
> ing() + "\">");
> 
>           String configdir = System.getProperty("user.dir") + "/config";
>           File pidFile = new File(configdir, "pid");
>           if (pidFile.exists()) {
>             out.println("<br>Status: Initializing...");
>             %>
>             <br>
>             <form method="post" action="stop.jsp">
>               <input type="submit" value="Stop Process">
>             </form>
>             <%
>           }
>           else {
>             out.println("<br>Status: Stopped");
>             %>
>             <br>
>             <form method="post" action="start.jsp">
>               <input type="submit" value="Start process">
>             </form>
>             <%
>           }
>         }
> %>
> 
> <%@ include file="footer.jsp" %>
> 
> Snippet of  validateLogin.jsp :
> 
> <%
>     String value = (String)session.getValue("das.login");
>     if (value == null) {
> %>
> Login password:
> <form method="post" action="login.jsp?url=<%= request.getServletPath()
> %>" name=
> "login">
>     <input type="password" size="20" name="password">
>     <input type="submit" value="submit">
> </form>
> <%
>         return;
>     }
> %>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Behaviour of JSP with tomcat 4.1.24

Posted by Sarika Inamdar <si...@cisco.com>.
Hi,

Thanks for the clarifications.

In server.xml, I put in the following configuration :

<Manager className="org.apache.catalina.session.PersistentManager"
              debug="0"
              saveOnRestart="false"
              maxActiveSessions="-1"
              minIdleSwap="-1"
              maxIdleSwap="-1"
              maxIdleBackup="-1">
                <Store
className="org.apache.catalina.session.FileStore"/>
          </Manager>

Its given that 
"To clear sessions from the Store, set maxActiveSessions, maxIdleSwap,
and minIdleBackup all to -1, saveOnRestart to false, then restart 
Catalina."

With the above configuration also, am unable to get the desired
behaviour ie, the index.jsp is not prompting for password.

Is there any other configuration I need to do ? Please help me on this.

Thanks,
Sarika


> -----Original Message-----
> From: Mike Curwen [mailto:gb_dev@gb-im.com] 
> Sent: Wednesday, August 06, 2003 7:36 PM
> To: 'Tomcat Users List'; sinamdar@cisco.com
> Subject: RE: Behaviour of JSP with tomcat 4.1.24
> 
> 
> You are experiencing valid behaviour, as Tomcat 4x will 
> persist sessions to disk.  This is supposed to allow sessions 
> to survive between server restarts ( a desirable situation in 
> most cases) When you clear out the work directory, the 
> sessions stored on disk are cleared.  
>  
> There is a way to turn off the persistent sessions... check 
> for any <Manager tags in server.xml
> 
> > -----Original Message-----
> > From: Sarika Inamdar [mailto:sinamdar@cisco.com]
> > Sent: Wednesday, August 06, 2003 12:16 AM
> > To: tomcat-user@jakarta.apache.org
> > Subject: Behaviour of JSP with tomcat 4.1.24
> > 
> > 
> > Hi All,
> > 
> > When we start tomcat and connect to the server, the index.jsp
> > page is displayed . When I key in a password, it validates 
> > the password and goes to the next jsp page(login.jsp)
> > 
> > I stop tomcat and restart it again. Now when I connect to the
> > server, the index.jsp directly takes me to the login.jsp page 
> > without asking for password. This should not happen. 
> > Everytime the tomcat is stopped 'n started we should get the 
> > password validation.
> > 
> > But when I stop tomcat and clear the contents of
> > $CATALINA_HOME/work/StandAlone/, When tomcat is started, it 
> > displays the index.jsp which asks for password validation.
> > 
> > This behaviour was not seen in tomcat 3.2.3.
> > 
> > Please let me know if am missing something.  Am attaching the
> > code snippet of index.jsp and validateLogin.jsp which is 
> > called from index.jsp
> > 
> > Thanks in Advance for the help,
> > Sarika
> > 
> > 
> > Here is code snippet of index.jsp :
> > 
> > %@ include file="header.jsp" %>
> > <%@ include file="validateLogin.jsp" %>
> > 
> > <%@ page import="com.cisco.das.core.*" %>
> > 
> > <b>Home</b>
> > <br>Host: <%= InetAddress.getLocalHost() %>
> > <br>Current time: <%= new Date() %>
> > 
> > <%
> >         try {
> >           String s = DAS.status();
> >           ByteArrayInputStream bs = new
> > ByteArrayInputStream(s.getBytes());
> > 
> >           Properties prop = new Properties();
> >           prop.load(bs);
> > 
> >           out.println("<br>Status: Running");
> > 
> >           out.println("<br>CNS name: " + prop.getProperty("name"));
> >           out.println("<br>CNS group: " +
> > prop.getProperty("group", ""));
> > 
> >           out.println("<br>Start time: " +
> >                       new
> > Date(Long.parseLong(prop.getProperty("startTime"))
> > ));
> >           out.println("<br>Version: " +
> > prop.getProperty("package.version"));
> >           out.println("<br>Build date: " + 
> > prop.getProperty("package.date"));
> > 
> >           %>
> >           <br>
> >           <br>
> >           <form method="post" action="stop.jsp">
> >             <input type="submit" value="Stop process">
> >           </form>
> >           <%
> >         } catch (Exception e) {
> >          out.println("<input type=\"hidden\" name=\"debug\"
> > value=\"" + e.toStr
> > ing() + "\">");
> > 
> >           String configdir = System.getProperty("user.dir") +
> > "/config";
> >           File pidFile = new File(configdir, "pid");
> >           if (pidFile.exists()) {
> >             out.println("<br>Status: Initializing...");
> >             %>
> >             <br>
> >             <form method="post" action="stop.jsp">
> >               <input type="submit" value="Stop Process">
> >             </form>
> >             <%
> >           }
> >           else {
> >             out.println("<br>Status: Stopped");
> >             %>
> >             <br>
> >             <form method="post" action="start.jsp">
> >               <input type="submit" value="Start process">
> >             </form>
> >             <%
> >           }
> >         }
> > %>
> > 
> > <%@ include file="footer.jsp" %>
> > 
> > Snippet of  validateLogin.jsp :
> > 
> > <%
> >     String value = (String)session.getValue("das.login");
> >     if (value == null) {
> > %>
> > Login password:
> > <form method="post" action="login.jsp?url=<%=
> > request.getServletPath() %>" name= "login">
> >     <input type="password" size="20" name="password">
> >     <input type="submit" value="submit">
> > </form>
> > <%
> >         return;
> >     }
> > %>
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > 
> 
> 


RE: Behaviour of JSP with tomcat 4.1.24

Posted by Sarika Inamdar <si...@cisco.com>.
Hi,

Thanks for the clarifications.

In server.xml, I put in the following configuration :

<Manager className="org.apache.catalina.session.PersistentManager"
              debug="0"
              saveOnRestart="false"
              maxActiveSessions="-1"
              minIdleSwap="-1"
              maxIdleSwap="-1"
              maxIdleBackup="-1">
                <Store
className="org.apache.catalina.session.FileStore"/>
          </Manager>

Its given that 
"To clear sessions from the Store, set maxActiveSessions, maxIdleSwap,
and minIdleBackup all to -1, saveOnRestart to false, then restart 
Catalina."

With the above configuration also, am unable to get the desired
behaviour ie, the index.jsp is not prompting for password.

Is there any other configuration I need to do ? Please help me on this.

Thanks,
Sarika


> -----Original Message-----
> From: Mike Curwen [mailto:gb_dev@gb-im.com] 
> Sent: Wednesday, August 06, 2003 7:36 PM
> To: 'Tomcat Users List'; sinamdar@cisco.com
> Subject: RE: Behaviour of JSP with tomcat 4.1.24
> 
> 
> You are experiencing valid behaviour, as Tomcat 4x will 
> persist sessions to disk.  This is supposed to allow sessions 
> to survive between server restarts ( a desirable situation in 
> most cases) When you clear out the work directory, the 
> sessions stored on disk are cleared.  
>  
> There is a way to turn off the persistent sessions... check 
> for any <Manager tags in server.xml
> 
> > -----Original Message-----
> > From: Sarika Inamdar [mailto:sinamdar@cisco.com]
> > Sent: Wednesday, August 06, 2003 12:16 AM
> > To: tomcat-user@jakarta.apache.org
> > Subject: Behaviour of JSP with tomcat 4.1.24
> > 
> > 
> > Hi All,
> > 
> > When we start tomcat and connect to the server, the index.jsp
> > page is displayed . When I key in a password, it validates 
> > the password and goes to the next jsp page(login.jsp)
> > 
> > I stop tomcat and restart it again. Now when I connect to the
> > server, the index.jsp directly takes me to the login.jsp page 
> > without asking for password. This should not happen. 
> > Everytime the tomcat is stopped 'n started we should get the 
> > password validation.
> > 
> > But when I stop tomcat and clear the contents of
> > $CATALINA_HOME/work/StandAlone/, When tomcat is started, it 
> > displays the index.jsp which asks for password validation.
> > 
> > This behaviour was not seen in tomcat 3.2.3.
> > 
> > Please let me know if am missing something.  Am attaching the
> > code snippet of index.jsp and validateLogin.jsp which is 
> > called from index.jsp
> > 
> > Thanks in Advance for the help,
> > Sarika
> > 
> > 
> > Here is code snippet of index.jsp :
> > 
> > %@ include file="header.jsp" %>
> > <%@ include file="validateLogin.jsp" %>
> > 
> > <%@ page import="com.cisco.das.core.*" %>
> > 
> > <b>Home</b>
> > <br>Host: <%= InetAddress.getLocalHost() %>
> > <br>Current time: <%= new Date() %>
> > 
> > <%
> >         try {
> >           String s = DAS.status();
> >           ByteArrayInputStream bs = new
> > ByteArrayInputStream(s.getBytes());
> > 
> >           Properties prop = new Properties();
> >           prop.load(bs);
> > 
> >           out.println("<br>Status: Running");
> > 
> >           out.println("<br>CNS name: " + prop.getProperty("name"));
> >           out.println("<br>CNS group: " +
> > prop.getProperty("group", ""));
> > 
> >           out.println("<br>Start time: " +
> >                       new
> > Date(Long.parseLong(prop.getProperty("startTime"))
> > ));
> >           out.println("<br>Version: " +
> > prop.getProperty("package.version"));
> >           out.println("<br>Build date: " + 
> > prop.getProperty("package.date"));
> > 
> >           %>
> >           <br>
> >           <br>
> >           <form method="post" action="stop.jsp">
> >             <input type="submit" value="Stop process">
> >           </form>
> >           <%
> >         } catch (Exception e) {
> >          out.println("<input type=\"hidden\" name=\"debug\"
> > value=\"" + e.toStr
> > ing() + "\">");
> > 
> >           String configdir = System.getProperty("user.dir") +
> > "/config";
> >           File pidFile = new File(configdir, "pid");
> >           if (pidFile.exists()) {
> >             out.println("<br>Status: Initializing...");
> >             %>
> >             <br>
> >             <form method="post" action="stop.jsp">
> >               <input type="submit" value="Stop Process">
> >             </form>
> >             <%
> >           }
> >           else {
> >             out.println("<br>Status: Stopped");
> >             %>
> >             <br>
> >             <form method="post" action="start.jsp">
> >               <input type="submit" value="Start process">
> >             </form>
> >             <%
> >           }
> >         }
> > %>
> > 
> > <%@ include file="footer.jsp" %>
> > 
> > Snippet of  validateLogin.jsp :
> > 
> > <%
> >     String value = (String)session.getValue("das.login");
> >     if (value == null) {
> > %>
> > Login password:
> > <form method="post" action="login.jsp?url=<%=
> > request.getServletPath() %>" name= "login">
> >     <input type="password" size="20" name="password">
> >     <input type="submit" value="submit">
> > </form>
> > <%
> >         return;
> >     }
> > %>
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Behaviour of JSP with tomcat 4.1.24

Posted by Mike Curwen <gb...@gb-im.com>.
You are experiencing valid behaviour, as Tomcat 4x will persist sessions
to disk.  This is supposed to allow sessions to survive between server
restarts ( a desirable situation in most cases) When you clear out the
work directory, the sessions stored on disk are cleared.  
 
There is a way to turn off the persistent sessions... check for any
<Manager tags in server.xml

> -----Original Message-----
> From: Sarika Inamdar [mailto:sinamdar@cisco.com] 
> Sent: Wednesday, August 06, 2003 12:16 AM
> To: tomcat-user@jakarta.apache.org
> Subject: Behaviour of JSP with tomcat 4.1.24
> 
> 
> Hi All,
> 
> When we start tomcat and connect to the server, the index.jsp 
> page is displayed . When I key in a password, it validates 
> the password and goes to the next jsp page(login.jsp)
> 
> I stop tomcat and restart it again. Now when I connect to the 
> server, the index.jsp directly takes me to the login.jsp page 
> without asking for password. This should not happen. 
> Everytime the tomcat is stopped 'n started we should get the 
> password validation.
> 
> But when I stop tomcat and clear the contents of 
> $CATALINA_HOME/work/StandAlone/, When tomcat is started, it 
> displays the index.jsp which asks for password validation.
> 
> This behaviour was not seen in tomcat 3.2.3.
> 
> Please let me know if am missing something.  Am attaching the 
> code snippet of index.jsp and validateLogin.jsp which is 
> called from index.jsp
> 
> Thanks in Advance for the help,
> Sarika
> 
> 
> Here is code snippet of index.jsp :
> 
> %@ include file="header.jsp" %>
> <%@ include file="validateLogin.jsp" %>
> 
> <%@ page import="com.cisco.das.core.*" %>
> 
> <b>Home</b>
> <br>Host: <%= InetAddress.getLocalHost() %>
> <br>Current time: <%= new Date() %>
> 
> <%
>         try {
>           String s = DAS.status();
>           ByteArrayInputStream bs = new 
> ByteArrayInputStream(s.getBytes());
> 
>           Properties prop = new Properties();
>           prop.load(bs);
> 
>           out.println("<br>Status: Running");
> 
>           out.println("<br>CNS name: " + prop.getProperty("name"));
>           out.println("<br>CNS group: " + 
> prop.getProperty("group", ""));
> 
>           out.println("<br>Start time: " +
>                       new
> Date(Long.parseLong(prop.getProperty("startTime"))
> ));
>           out.println("<br>Version: " + 
> prop.getProperty("package.version"));
>           out.println("<br>Build date: " + 
> prop.getProperty("package.date"));
> 
>           %>
>           <br>
>           <br>
>           <form method="post" action="stop.jsp">
>             <input type="submit" value="Stop process">
>           </form>
>           <%
>         } catch (Exception e) {
>          out.println("<input type=\"hidden\" name=\"debug\" 
> value=\"" + e.toStr
> ing() + "\">");
> 
>           String configdir = System.getProperty("user.dir") + 
> "/config";
>           File pidFile = new File(configdir, "pid");
>           if (pidFile.exists()) {
>             out.println("<br>Status: Initializing...");
>             %>
>             <br>
>             <form method="post" action="stop.jsp">
>               <input type="submit" value="Stop Process">
>             </form>
>             <%
>           }
>           else {
>             out.println("<br>Status: Stopped");
>             %>
>             <br>
>             <form method="post" action="start.jsp">
>               <input type="submit" value="Start process">
>             </form>
>             <%
>           }
>         }
> %>
> 
> <%@ include file="footer.jsp" %>
> 
> Snippet of  validateLogin.jsp :
> 
> <%
>     String value = (String)session.getValue("das.login");
>     if (value == null) {
> %>
> Login password:
> <form method="post" action="login.jsp?url=<%= 
> request.getServletPath() %>" name= "login">
>     <input type="password" size="20" name="password">
>     <input type="submit" value="submit">
> </form>
> <%
>         return;
>     }
> %>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Behaviour of JSP with tomcat 4.1.24

Posted by Mike Curwen <gb...@gb-im.com>.
You are experiencing valid behaviour, as Tomcat 4x will persist sessions
to disk.  This is supposed to allow sessions to survive between server
restarts ( a desirable situation in most cases) When you clear out the
work directory, the sessions stored on disk are cleared.  
 
There is a way to turn off the persistent sessions... check for any
<Manager tags in server.xml

> -----Original Message-----
> From: Sarika Inamdar [mailto:sinamdar@cisco.com] 
> Sent: Wednesday, August 06, 2003 12:16 AM
> To: tomcat-user@jakarta.apache.org
> Subject: Behaviour of JSP with tomcat 4.1.24
> 
> 
> Hi All,
> 
> When we start tomcat and connect to the server, the index.jsp 
> page is displayed . When I key in a password, it validates 
> the password and goes to the next jsp page(login.jsp)
> 
> I stop tomcat and restart it again. Now when I connect to the 
> server, the index.jsp directly takes me to the login.jsp page 
> without asking for password. This should not happen. 
> Everytime the tomcat is stopped 'n started we should get the 
> password validation.
> 
> But when I stop tomcat and clear the contents of 
> $CATALINA_HOME/work/StandAlone/, When tomcat is started, it 
> displays the index.jsp which asks for password validation.
> 
> This behaviour was not seen in tomcat 3.2.3.
> 
> Please let me know if am missing something.  Am attaching the 
> code snippet of index.jsp and validateLogin.jsp which is 
> called from index.jsp
> 
> Thanks in Advance for the help,
> Sarika
> 
> 
> Here is code snippet of index.jsp :
> 
> %@ include file="header.jsp" %>
> <%@ include file="validateLogin.jsp" %>
> 
> <%@ page import="com.cisco.das.core.*" %>
> 
> <b>Home</b>
> <br>Host: <%= InetAddress.getLocalHost() %>
> <br>Current time: <%= new Date() %>
> 
> <%
>         try {
>           String s = DAS.status();
>           ByteArrayInputStream bs = new 
> ByteArrayInputStream(s.getBytes());
> 
>           Properties prop = new Properties();
>           prop.load(bs);
> 
>           out.println("<br>Status: Running");
> 
>           out.println("<br>CNS name: " + prop.getProperty("name"));
>           out.println("<br>CNS group: " + 
> prop.getProperty("group", ""));
> 
>           out.println("<br>Start time: " +
>                       new
> Date(Long.parseLong(prop.getProperty("startTime"))
> ));
>           out.println("<br>Version: " + 
> prop.getProperty("package.version"));
>           out.println("<br>Build date: " + 
> prop.getProperty("package.date"));
> 
>           %>
>           <br>
>           <br>
>           <form method="post" action="stop.jsp">
>             <input type="submit" value="Stop process">
>           </form>
>           <%
>         } catch (Exception e) {
>          out.println("<input type=\"hidden\" name=\"debug\" 
> value=\"" + e.toStr
> ing() + "\">");
> 
>           String configdir = System.getProperty("user.dir") + 
> "/config";
>           File pidFile = new File(configdir, "pid");
>           if (pidFile.exists()) {
>             out.println("<br>Status: Initializing...");
>             %>
>             <br>
>             <form method="post" action="stop.jsp">
>               <input type="submit" value="Stop Process">
>             </form>
>             <%
>           }
>           else {
>             out.println("<br>Status: Stopped");
>             %>
>             <br>
>             <form method="post" action="start.jsp">
>               <input type="submit" value="Start process">
>             </form>
>             <%
>           }
>         }
> %>
> 
> <%@ include file="footer.jsp" %>
> 
> Snippet of  validateLogin.jsp :
> 
> <%
>     String value = (String)session.getValue("das.login");
>     if (value == null) {
> %>
> Login password:
> <form method="post" action="login.jsp?url=<%= 
> request.getServletPath() %>" name= "login">
>     <input type="password" size="20" name="password">
>     <input type="submit" value="submit">
> </form>
> <%
>         return;
>     }
> %>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>