lol.. u sound like u have had a bad experience with declaration blocks :) actually the only reason i said to use a declarative block is:
"A declaration has translation unit scope, so it is valid in the JSP page and any of its static include files. A static include file becomes part of the source of the JSP page and is any file included with an include directive or a static resouce included with a <jsp:include> element. The scope of a declaration does not include dynamic resources included with <jsp:include>." - jsp reference guide (link that i included earlier) You can declare the same thing in a scriplet but it wont be available to anything but that immediate page. What a pain especially if ur using something like tiles or a tiles like structure. Everyone should know what the difference between scriplets/declarations/and expressions is. If your not a newbie and you dont know exactly what a declaration block is then you shouldnt be coding JSP pages. (sorry if that sounded rude. it's early and i cant think of a more tactful way to say that) -Tim -----Original Message----- From: Geert Van Damme [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 09, 2002 9:21 AM To: [EMAIL PROTECTED] Subject: Re: I want to make code shorter. No! I don't see how a declaration would help here. In fact You hardly ever need to use declarations. Most people don't know exactly what a declaration does. As long as you're not 100% sure what it is. Don't ever use it !!!! Geert > -----Original Message----- > From: A mailing list about Java Server Pages specification and reference > [mailto:[EMAIL PROTECTED]]On Behalf Of Chen, Gin > Sent: woensdag 9 januari 2002 15:16 > To: [EMAIL PROTECTED] > Subject: Re: I want to make code shorter. > > > use a declarative block instead. > <%! vs <% > look at this doc: > http://java.sun.com/products/jsp/tags/12/syntaxref12.html > and look at the difference between declaration and scriplet. > You should probably bookmark this page. You'll get alot of answers to > questions like this. > -Tim > > -----Original Message----- > From: seiju@home [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 08, 2002 9:43 PM > To: [EMAIL PROTECTED] > Subject: I want to make code shorter. > > > Hello. I am having codes as below. > I'd like to know how to write them as methods. This is because > I am writing exactly the same twice which as a result makes > code long and redundant. > I am imaging for the code to look like: > if (condition) { > .....statement.... > func(); <- created method > } else { > .....statement... > func(); <- created method > } > > > Code I want to write as func(); > ------------------------------------------------------- > while(rs.next()) { > if (condition) { > %> > ---HTML--- > <% > tableHTML = ---htmlstring---; > %> > <%= tableHTML %> > <% > ResultSet rs2 = db2.getResultSet(...SQL...); > ResultSet rs3 = db3.getResultSet(...SQL...); > while (rs2.next()) { > .........statement.......... > while (rs3.next()) { > .......statement.......... > } // rs3 loop > } // rs2 loop > } // if > } // rs loop > %> > ------------------------------------------------------- > > ================================================================== > ========= > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff > JSP-INTEREST". > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST > DIGEST". > Some relevant FAQs on JSP/Servlets can be found at: > > http://archives.java.sun.com/jsp-interest.html > http://java.sun.com/products/jsp/faq.html > http://www.esperanto.org.nz/jsp/jspfaq.jsp > http://www.jguru.com/faq/index.jsp > http://www.jspinsider.com > > ================================================================== > ========= > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff > JSP-INTEREST". > For digest: mailto [EMAIL PROTECTED] with body: "set > JSP-INTEREST DIGEST". > Some relevant FAQs on JSP/Servlets can be found at: > > http://archives.java.sun.com/jsp-interest.html > http://java.sun.com/products/jsp/faq.html > http://www.esperanto.org.nz/jsp/jspfaq.jsp > http://www.jguru.com/faq/index.jsp > http://www.jspinsider.com > =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
