any suggestions?...im thinking somewhere between lines 163-185, but I'm stumped

<%@ page language="java" %>

<%@ page import="trader.webservices.data.LeadDAO" %>
<%@ page import="trader.aabacrm.LeadsList" %>
<%@ page import="trader.webservices.data.*" %>
<%@ page import="trader.webservices.presentation.Lead" %>
<%@ page import="trader.webservices.data.UserInfoDAO" %>
<%@ page import="trader.webservices.data.UserDataVO" %>
<%@ page import="trader.webservices.data.ButtonDAO" %>
<%@ page import="trader.webservices.constants.UserConstants" %>
<%@ page import="trader.webservices.util.Utils" %>
<%@ page import="java.math.*" %>


<%
    RequestDispatcher dispatcher = request.getRequestDispatcher("/jsp/ErrorPage.jsp");

    UserDataVO userData = null;

    String username = request.getParameter("username");
    String password = request.getParameter("password");

    boolean loginOkay = false;
    boolean trialOkay = true;
    boolean pageError = false;

    if ((username != null) && (password != null)) {
        loginOkay = UserInfoDAO.verifyLogin(username,password);
        if (loginOkay) trialOkay = UserInfoDAO.checkTrialOkay(username);
    }

    if (loginOkay && trialOkay) {
        try{
            /**
            * Get accountInfo based on accountName
            */
            if (username != null) {
                userData = UserInfoDAO.getUserInfo(username);
            }
            if (userData != null) {
                userData.setHeaderLogo(UserInfoDAO.getHeaderLogo(userData));
                userData.setMaxMB(UserInfoDAO.getMaxMB(userData.getAccountID()));
                UserInfoDAO.getCriticalPathData(userData); 

            } else {
                pageError = true;
            }
        }catch(Exception e){
            request.setAttribute("pageError","An error occured trying to log into control panel.");
            dispatcher.forward(request, response);
        }
    }
    String mainpageText = UserInfoDAO.getMainpageText(userData);
%>

<%
// preparse results of the transfer to emc and other specific pages that send back to here, if applicable
String otherResults = "";

try {
  if (request.getParameter("lastAction").equals("emcTransfer")) {
    int leadsUpdated = Integer.parseInt(request.getParameter("lead_upd"));
    int leadsCreated = Integer.parseInt(request.getParameter("lead_new"));
    int leadsErrored = Integer.parseInt(request.getParameter("lead_err"));
    otherResults = "You transferred " + (leadsUpdated+leadsCreated) + " leads. " + leadsUpdated + " updated, " + leadsCreated + " new.";
    if (leadsErrored > 0) {
        otherResults = otherResults + " " + leadsErrored + " leads were duplicates or could not be transferred to the Email Marketing Center.";
    }
  }
} catch (Exception e) {
  otherResults = "";
}
%>





    <%

        try
        {
            System.out.println("The domainName string is: " + domainName);
             //Get accountInfo based on domainName
            domainName = UserInfoDAO.removeHostRedirection(domainName);
            userData = UserInfoDAO.getUserInfo(domainName);
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
            response.sendRedirect("../ErrorPageCPanel.jsp");
        }

        //for beta controlpanel, get the domain name from the form post (this is how it always works in old cp)
        if (userData == null) {
            userData = UserInfoDAO.getUserInfo(request.getParameter("username"));
        }

        if (userData!=null) {               
            //get HashMap from biz layer of leads/contacts
            int agentId = userData.getAgentID();
            int adverId = userData.getAdverID();
            //System.out.println("agentId:" + agentId);
            //System.out.println("adverId:" + adverId);
            LeadsList leads = null;
            HashMap currLead = null;

            String agentOrBroker = null;
            int agentOrAdverId = 0;
            if (adverId == 0) { //agent site
                agentOrBroker = "agent";
                agentOrAdverId = agentId;
            } 
            else {
                agentOrBroker = "broker";
                agentOrAdverId = adverId;
            }


            if (sOrderBy.equals("")) {
                leads = new LeadsList(agentOrBroker,agentOrAdverId);
            } 
            else {
                if (bOrderDesc) 
                {
                    String orderBy[] = sOrderBy.split(",");
                    String expandedOrderBy = orderBy[0] + " DESC";
                    for (int i = 1; i < orderBy.length; i++) 
                    {
                        expandedOrderBy += "," + orderBy[i] + "DESC";
                    }
                    leads = new LeadsList(agentOrBroker,agentOrAdverId,expandedOrderBy);
                } 
                else {
                    leads = new LeadsList(agentOrBroker,agentOrAdverId,sOrderBy);
                }
            }

            %>







<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Control Panel - Website &amp; Content</title>
<link rel="stylesheet" type="text/css" media="screen" href="/JAABA/skins/aaDefault/styles/cp-contentwell.css" />
</head>


<body>

        <jsp:include page="../Includes/controlPanel/sessionInfo.jsp" >
            <jsp:param name="username" value="<%=userData.getAcctName()%>" />
        </jsp:include>

        <!--This sets up the javascript array that holds the leads. -->
        <script language="JavaScript">

                int unViewedCt = 0;
                  out.write("var jsLeads = new Array();\n");
                    for (int i=0; i< leads.size(); i++) {
                      currLead = (HashMap)leads.get(i);

                        out.write("jsLeads["+ i +"] = new Array();\n");
                        out.write("jsLeads[" + i + "][0] = '" + currLead.get("PK_LEADID") + "';\n");
                        out.write("jsLeads[" + i + "][1] = '" + currLead.get("CON_ID") + "';\n");
                        out.write("jsLeads[" + i + "][2] = " + currLead.get("BO_VISIBLE") + ";\n"); 
                        //could be null in the table but is NVL'd in the view
        //              Integer currVis =(Integer) currLead.get("BO_VISIBLE");
        //              System.out.println("currVis:" + currVis);
        //              out.write("jsLeads[" + i + "][2] = " + Utils.getStringNull((((Integer)currLead.get("BO_VISIBLE")).toString()),"0") + ";\n");

                        if (new Integer(currLead.get("BO_VIEWED").toString()).intValue() == 0 ) {

                            unViewedCt++;
                        }
                    }
        </script>            




<div id="cWell" class="clearfix">

<h1>Welcome to your New Control Panel</h1>

<div id="cWellMain">

<%=mainpageText%>

<!-- START OLD SCHOOL NEWS BOX -->
<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr><td colspan="2" align="CENTER" bgcolor="#FFCF63"><font face="Arial,Helvetica,Sans-Serif" size="4"><b>Real Estate News</b></td></tr><tr><td><font face="Arial,Helvetica,Sans-Serif" size="3"><b>Consumer News</b></font><br>

<br><a href="news-sample.html" title="Consumers aren't being cocky when they expect to reap profits from the sale of their home, even in a down market. "><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><b>Consumers: "What Housing Bust?"</b></font><br>
<font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><i>JUN 25, 2007</i></font></a><br>
<br><a href="javascript:submit_form_with_qs('newsstory=222917');" title="How do you really measure square footage in a condominium unit? "><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><b>Housing Counsel: The Quagmire Called Square Footage</b></font><br><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><i>JUN 25, 2007</i></font></a><br>
<br><a href="javascript:submit_form_with_qs('newsstory=222919');" title="A study prepared for the Mortgage Bankers Association of America estimates that incidence of home loan fraud jumped by 30"><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><b>Mortgage Fraud Rising Fast; Florida and California Now the Hot Spots</b></font><br><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><i>JUN 25, 2007</i></font></a><br>
<br><a href="javascript:submit_form_with_qs('newspage=Consumer');"><font face="Arial,Helvetica,Sans-Serif" size="2" color="#993333"><b><i>More Consumer News</i></b></font></a><br>
</td><td><font face="Arial,Helvetica,Sans-Serif" size="3"><b>Commercial News</b></font><br>
<br><a href="javascript:submit_form_with_qs('newsstory=222920');" title="An entire team working for you -- even when you sleep? "><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><b>A Day In The Life Of A Virtually Supported Agent</b></font><br><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><i>JUN 25, 2007</i></font></a><br>
<br><a href="javascript:submit_form_with_qs('newsstory=222921');" title="Working from home can help real estate agents be more productive if they know how to make their surroundings function well"><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><b>Ten Ways To Work Real Estate More Effectively From Home</b></font><br><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><i>JUN 25, 2007</i></font></a><br>

<br><a href="javascript:submit_form_with_qs('newsstory=222822');" title="The California Association of Realtors (CAR) opposes private transfer taxes and has sought legislation that would prohibit them. "><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><b>Legislative Support for Private Transfer Taxes</b></font><br><font face="Arial,Helvetica,Sans-Serif" size="1" color="#993333"><i>JUN 22, 2007</i></font></a><br>
<br><a href="javascript:submit_form_with_qs('newspage=Commercial');"><font face="Arial,Helvetica,Sans-Serif" size="2" color="#993333"><b><i>More Commercial News</i></b></font></a><br>
  </td></tr></table>
<!-- END OLD SCHOOL NEWS BOX -->

</div><!-- end cWellMain -->


<div id="cWellSide">


<div id="stats">
    <h3><%= unViewedCt++ %></h3>
    <p>stats go here</p>
</div>

<div class="ad">
<div id="ad1"><p>To view product &amp; service opportunities from <strong>Agent Advantage</strong>, please install the <a href="http://www.adobe.com/go/gntray_dl_getflashplayer" target="_blank">Flash Plug-in</a>.</p></div>
</div><!-- end ad -->

<div class="ad">
<div id="ad2"><p>To view product &amp; service opportunities from <strong>Agent Advantage</strong>, please install the <a href="http://www.adobe.com/go/gntray_dl_getflashplayer" target="_blank">Flash Plug-in</a>.</p></div>
</div><!-- end ad -->

</div><!-- end cWellSide -->

</div><!-- END cWell -->
</body>
</html>

thanx....

A very simple answer, move all that scriptlet stuff out of this JSP into a (or probably multiple) beans.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.