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
