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

Reply via email to