> -----Original Message----- > From: Matt Jibson [mailto:[EMAIL PROTECTED] > Sent: Monday, August 14, 2006 12:15 PM > To: users@tomcat.apache.org > Subject: JSP declarations persisting over page loads > > Using Tomcat 5.5.17 and a HTML <body> of: > > <%! boolean processed = false; %> > <br/><%=processed%> > <% processed = !processed; %> > <br/><%=processed%> > > subsequent page loads will toggle the output. The first load is false, > true. Second true, false. Etc. This is reproducable in 5.0.28. Is this > expected behavior?
Yes. <%! ... %> creates page-wide definitions, which if you look at the compiled .jsp (the .java file) you will notice it becomes a class variable. If you use <% ... %> it is a local reference which gets initialized on every request. Google for jsp quick reference and you will find out more. Tim --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]