上个帖子忘上传附件了  希望管理员删除!~
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> 
<%@ page contentType="text/html; charset=utf-8" language="java" errorPage="" %> 
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 
<%@ taglib prefix="psy" uri="http://www.psychcn.com/taglibs" %> 
<%@ include file="../../include/i18n.jsp" %> 
<%@ page import="com.psychcn.hibernate.*" %> 
<%@ page import="com.psychcn.eap.*" %> 
<%@ page import="java.util.*" %> 
<%@ page import="com.psychcn.eap.customer.*" %> 
<html> <head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
<title> <fmt:message key="include.Title"/> </title> 
<script src="../../js/shield.js"> </script> 
<script src="../../js/multiSelect.js"> </script> 
<script language="javascript" src="../../js/areadata-${loc}.js" charset="utf-8"> </script> 
<link href="../../css/new_admin.css" rel="stylesheet" type="text/css" /> 
<style> .tableTd1 { 
width:20%; 
padding-left: 35px; 

.tableTd2 { 
width:30%; 

.tableTd3 { 
width:20%; 
padding-left: 35px; 

.tableTd4 { 
width:30%; 

</style> 
<script src="../../js/left_pane_autohide.js"> </script> <script language="JavaScript" type="text/javascript"> function doOnload(){ 
theform.companyName.focus(); 
} <%--保存父框架的 cols 属性, 以便离开此页面时恢复--%> 
var frameset_body = top.document.getElementById("frameset_body"); 
var parent_cols_old = frameset_body.cols; 
//frameset_body.cols="0,*"; function CustomerManage(companyId) { 
parent.frames.mainFrame.document.location.href="../../action/customer/do_pre_index.jsp?companyId=" + companyId; 
// parent.frames.leftFrame.document.location.href="../../include/customerMenu.jsp?id=" +'companyId'; } 
function goPage(page) { 
theform.currentPage.value = page; 
theform.submit(); 

function checkManage(companyId){ 
theform.action="../../action/customer/do_add_latelyVisit.jsp?clientId=" + companyId; 
theform.submit(); 

function checkSearch(){ 
theform.validateSearch.value="check"; 
theform.submit(); 

</script> 
</head> 
<% 
//----------------------------------------------------- 
//最近访问列表 
String sql = "select c.companyId,c.gradatNumber,c.name,u.name as uName,a.visitTime from (SELECT DISTINCT lv.ClientId,lv.visitTime FROM LatelyVisit lv WHERE lv.userId=? AND lv.clientType=?) a left join company c on c.companyid=a.ClientId LEFT OUTER JOIN Users u ON c.AccountManager = u.UserID ORDER BY visitTime DESC"; 
// String sql = "SELECT c.companyId,c.gradatNumber,c.name,u.name as uName FROM Company c LEFT OUTER JOIN Users u ON c.AccountManager = u.UserID WHERE (CompanyID IN (SELECT DISTINCT lv.ClientId FROM LatelyVisit lv WHERE lv.userId=?))"; 
List <Object> l = new ArrayList <Object>(); 
l.add(session.getAttribute("logUserId")); 
l.add(LatelyVisit.getCompanyType()); 
HibernatePagingResult lv_pr = AppResource.sqlQuery(sql,l,10,1); boolean lv_null = false; 
if(lv_pr.result.size()==0){ 
lv_null = true; 

request.setAttribute("lv_pr",lv_pr); 
request.setAttribute("lv_null",lv_null); 
//----------------------------------------------------- 
//获得项目经理列表 
List amLists = AppResource.userService.findAll(); 
request.setAttribute("amLists",amLists); //----------------------------------------------------- 
//获得公司编号的头字母 
char idPrefix = Company.getIdPrefix(); 
request.setAttribute("idPrefix",idPrefix); 
//获得当前页 
String currentPage = request.getParameter("currentPage"); /**********************************最近加入客户列表***********************************/ 
String hql = "FROM Company c ORDER BY c.companyId DESC"; 
HibernatePagingResult pr2 = (HibernatePagingResult)AppResource.hqlQuery(hql, 10, 1); 
request.setAttribute("lists",pr2.result); 这是一个服务平台的客户管理部分,我想知道每段代码都是什么功能就可以,在毕业设计中需要分析一些代码,只能看懂一部分有很多细节上的东西不懂,不能在毕业设计上乱写呀。麻烦大家帮帮忙,主要是上面的代码每段都是实现什么功能的,在附件中有这段代码的运行效果图。

解决方案 »

  1.   

    /************************************查询客户****************************************/ 
    String conditions = ""; 
    int pageIndex = 1; 
    if (currentPage != null && currentPage.length()>0) { 
    pageIndex = Integer.parseInt(currentPage); 
    } String companyName = request.getParameter("companyName"); //公司名称 String gradatNumber = request.getParameter("gradatNumber"); //公司编号 String accountManager = request.getParameter("accountManager"); //总项目经理 String relatedEntity = request.getParameter("relatedEntity"); //相关组织机构 String status_p = request.getParameter("status"); //合同状态 
    Byte status = null; 
    if(status_p!=null && status_p.length()>0){ 
    status = Byte.parseByte(status_p); 
    } // callerLocation中包括 国、省、市、县。 
    //先获取国、省、市、县的值,callerLocation的值等于县、市、省、国这个顺序第一个不空的值。 
    String area = null; 
    String country = request.getParameter("country"); 
    String province = request.getParameter("province"); 
    String city = request.getParameter("city"); 
    String county = request.getParameter("county"); 
    if (county != null && county.length()>0){ 
    area = county; 
    } else if(city != null && city.length()>0){ 
    area = city; 
    }else if(province != null && province.length()>0){ 
    area = province; 
    }else if(country != null && country.length()>0){ 
    area = country; 

    Collection <Object> col = new LinkedList <Object>(); 
    if (companyName!=null && companyName.length()>0) { 
    conditions += "(c.name LIKE ?) AND "; 
    col.add("%" + companyName + "%"); 

    if (accountManager != null && accountManager.length()>0) { 
    conditions += "(c.accountManager.userId =?) AND "; 
    col.add(accountManager); 

    if (gradatNumber != null && gradatNumber.length()>0) { 
    conditions += "(c.gradatNumber LIKE ?) AND "; 
    col.add("%" + gradatNumber + "%"); 

    if (relatedEntity != null && relatedEntity.length()>0) { 
    conditions += "(c.relatedEntity LIKE ?) AND "; 
    col.add("%" + relatedEntity + "%"); 

    if (status != null) { 
    conditions += "(c.status=?) AND "; 
    col.add(status); 
    } String hql2; 
    if (area == null) { 
    if (conditions.length() > 0) 
    hql2 = "FROM Company c WHERE " + conditions.substring(0, conditions.length()-4); 
    else 
    hql2 = "FROM Company c "; 
    } else { 
    //conditions += "(divs.area LIKE '"+area+"%') "; 
    //hql2 = "FROM Company c LEFT JOIN c.divisions divs WHERE " + conditions; 
    if (conditions.length() >0) { 
    hql2 = "FROM Company c WHERE " + conditions + " c.companyId IN (SELECT d.company.companyId FROM Division d WHERE d.area LIKE '"+area+"%')"; 
    } else { 
    hql2 = "FROM Company c WHERE c.companyId IN (SELECT d.company.companyId FROM Division d WHERE d.area LIKE '"+area+"%')"; 

    } HibernatePagingResult pr = AppResource.hqlQuery(hql2, col, EapPageFace.MEMBERS_MANAGE_PAGE_SIZE, pageIndex); //创建查询参数集合 
    request.setAttribute("rowCount",pr.rowCount); 
    request.setAttribute("pageCount",pr.pageCount); //分页 
    request.setAttribute("pr",pr); 
    request.setAttribute("pr2", pr2); 
    request.setAttribute("pageLink","javascript:goPage({0})"); String validateSearchString = request.getParameter("validateSearch"); 
    boolean validateSearch = false; 
    if(validateSearchString!=null && validateSearchString.length()>0){ 
    validateSearch = true; 

    //Attribute 属性,特征  v. 归于,属于 
    request.setAttribute("validateSearch",validateSearch); 
    request.setAttribute("companyName",companyName); 
    request.setAttribute("gradatNumber",gradatNumber); 
    request.setAttribute("relatedEntity",relatedEntity); 
    request.setAttribute("status",status); 
    request.setAttribute("area",area); 
    request.setAttribute("accountManager",accountManager); 这是我分块贴的  应该都是实现一部分功能吧  希望不耽误各位看!
      

  2.   


    %> 
    <body unselectable="on" class="pathbar" onload="doOnload();" > 
    <form name="theform" method="post" action="../../jsp/customer/list.jsp" onkeypress="if(event.keyCode==13) theform.submit();"> 
    <input type="hidden" name="currentPage" value="${currentPage}"/> 
    <input type="hidden" name="src" value="company"/> 
    <input type="hidden" name="validateSearch" value=""> 
    <table width="100%"> 
    <tr> 
    <c:if test="${!lv_null}"> 
    <td valign="top"> 
    <fieldset> 
    <legend>      //            最近 访问 客户 
    <fmt:message key="customer.currentAccessEmployer"/> 
    </legend> 
    <table width="100%"> 
      <tr align="center"> 
        <td nowrap unselectable="on" class="t"> <fmt:message key="customer.companyNumber"/> </td> 
        <td nowrap unselectable="on" class="t"> <fmt:message key="public.coName"/> </td>     <td nowrap unselectable="on" class="t"> <fmt:message key="customer.generalAccountManagerName"/> </td> 
        <psy:op code="Employer_ReadInfor"> <td nowrap unselectable="on" class="t"> <fmt:message key="public.manage"/> </td> </psy:op> 
      </tr> 
      <c:forEach items="${lv_pr.result}" var="item" >  
      <tr align="center"> 
        <td>${idPrefix}${item[1]} </td> 
        <td>${item[2]} </td> 
        <td>${item[3]} </td> 
        <psy:op code="Employer_ReadInfor"> <td> <a class="link" href="#" onclick="checkManage('${item[0]}')"> <img src="../../images/modules.png"/> <fmt:message key="public.manage"/> </a> </td> </psy:op> 
      </tr> 
    </c:forEach> 
    </table> 
    </fieldset> 
    </td> 
    </c:if> 
    <td> 
    <fieldset> 
    <legend> 
    <fmt:message key="customer.currentAddEmployer"/> 
    </legend> 
    <table width="100%"> 
      <tr align="center"> 
        <td nowrap unselectable="on" class="t"> <fmt:message key="customer.companyNumber"/> </td> 
        <td nowrap unselectable="on" class="t"> <fmt:message key="public.coName"/> </td> 
        <td nowrap unselectable="on" class="t"> <fmt:message key="customer.generalAccountManagerName"/> </td> 
      <psy:op code="Employer_ReadInfor"> 
        <td nowrap unselectable="on" class="t"> <fmt:message key="public.manage"/> </td> 
      </psy:op> 
      </tr> 
      <c:forEach items="${lists}" var="item" >  
      <tr align="center"> 
        <td>${idPrefix}${item.gradatNumber} </td> 
        <td>${item.name} </td> 
        <td>${item.accountManager.name} </td> 
      <psy:op code="Employer_ReadInfor"> 
        <td> <a class="link" href="#" onclick="checkManage('${item.companyId}')"> <img src="../../images/modules.png"/> 
          <fmt:message key="public.manage"/> 
        </a> </td> 
      </psy:op> 
      </tr> 
    </c:forEach> 
    </table> 
    </fieldset> 
    </td> 
    </tr> 
    </table> <fieldset> 
    <legend> 
    <fmt:message key="customer.queryEmployer"/> 
    </legend> 
    <table align="center" width='100%' border="0" cellpadding="1" cellspacing="0"> 
      <tr> 
        <td class="tableTd1"> <fmt:message key="public.coName"/> </td> 
        <td class="tableTd2"> <input class="input_text" type="text" name="companyName" value="${companyName}"/> </td> 
        <td class="tableTd3"> <fmt:message key="customer.companyNumber"/> </td> 
        <td class="tableTd4">${idPrefix} <input type="text" name="gradatNumber" size="28" value="${gradatNumber}"/> </td> 
      </tr> 
      <tr> 
        <td class="tableTd1"> <fmt:message key="customer.accountManagerName"/> </td> 
        <td > <select name="accountManager"> 
        <option value="" > <fmt:message key="public.pleaseChoose"/> </option> 
        <c:forEach items="${amLists}" var="item"> 
        <option value="${item.userId}">${item.name} </option> 
        </c:forEach> 
        </select> </td> 
      <script language="JavaScript" type="text/javascript" > 
    selectValue(theform.accountManager, '${accountManager}') 
      </script> 
        <td class="tableTd3"> <fmt:message key="customer.interrelatedOrganization"/> </td> 
        <td> <input class="input_text" type="text" name="relatedEntity" value="${relatedEntity}"/> </td> 
      </tr> 
      <tr> 
        <td  class="tableTd1"> <fmt:message key="customer.cooperationStatus"/> </td> 
        <td colspan="3"> 
    <psy:dictionary id="status" name="status" dictionary="cooperationStatus" type="select" cols="1" value="${status}"> 
    <option value=""> <fmt:message key="public.pleaseChoose"/> </option> 
    </psy:dictionary> 
    </td> 
      </tr> 
      <tr> 
        <td  class="tableTd1"> <fmt:message key="public.placeRegion"/> </td> 
        <td colspan="3" > <select class="select_address" name="country" onchange="changeSelect('area', this, theform.province, theform.city,theform.county);"> <option value=""> <fmt:message key="public.pleaseChooseCountry"/> </option> </select> 
          &nbsp; <select class="select_address" name="province"  onchange="changeSelect('area',this,theform.city,theform.county);"> <option value=""> <fmt:message key="public.pleaseChooseProvince"/> </option> </select> 
          &nbsp; <select class="select_address" name="city" onchange="changeSelect('area', this, theform.county);"> <option value=""> <fmt:message key="public.pleaseChooseCity"/> </option> </select> 
          &nbsp; <select class="select_address" name="county"> <option value=""> <fmt:message key="public.pleaseChooseUrbanDistrict"/> </option> </select> 
      <script language="javascript"> 
    initSelectElement("area", theform.country); 
    if(${area!=null ¦ ¦ validateSearch}){ 
    initSelectValue("area", "${area}", theform.country, theform.province, theform.city, theform.county); 
    }else{ 
    initSelectValue("area", "${0086}", theform.country, theform.province, theform.city, theform.county); 

      </script> 
      </td> 
      </tr> 
    </table> 
    </fieldset> <psy:op code="Employer_Search"> 
    <div class="dialogbuttons" > 
    <button onclick="checkSearch();"> <fmt:message key="public.query"/> </button> 
    </div> 
    </psy:op> <fieldset> 
    <legend> 
    <fmt:message key="customer.queryAdFollowsResult"/> 
    </legend> 
    <table width="100%"> 
      <tr align="center"> 
        <td nowrap unselectable="on" class="t"> <fmt:message key="customer.companyNumber"/> </td> 
        <td nowrap unselectable="on" class="t"> <fmt:message key="public.coName"/> </td> 
        <td nowrap unselectable="on" class="t"> <fmt:message key="customer.generalAccountManagerName"/> </td> 
      <psy:op code="Employer_ReadInfor"> 
        <td nowrap unselectable="on" class="t"> <fmt:message key="public.manage"/> </td> 
      </psy:op> 
      </tr> 
      <c:forEach items="${pr.result}" var="item" >  
      <tr align="center"> 
        <td>${idPrefix}${item.gradatNumber} </td> 
        <td>${item.name} </td> 
        <td>${item.accountManager.name} </td> 
        <psy:op code="Employer_ReadInfor"> 
        <td> <a class="link" href="#" onclick="checkManage('${item.companyId}')"> <img src="../../images/modules.png"/> 
          <fmt:message key="public.manage"/> 
        </a> </td> 
        </psy:op> 
      </tr> 
    </c:forEach> <psy:op code="Employer_NewClient"> 
      <tr align="right"> 
        <td colspan="5"> <a class="link" href="add.jsp"> <img src="../../images/new.png"/> 
        <fmt:message key="customer.addNewEmployer"/> 
        </a> </td> 
      </tr> 
    </psy:op> 
      <tr> 
    <td colspan="4"  align = "right">共${rowCount}条记录  共${pageCount}页 <% pageContext.include("/include/pagination.jsp"); %> </td> 
      </tr> 
    </table> 
    </fieldset> 
    <br/> 
    <br/> 
    </form> 
    </body> 
    </html> 
    这是最后一部分