0

代码:

搜索.xhtml

    <!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"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:p="http://primefaces.org/ui"
        xmlns:f="http://java.sun.com/jsf/core">
    <h:head></h:head>
    <h:form id="form">
    <h:body>
    <h:outputLabel value="Kiosk Id"> </h:outputLabel>
    <p:selectOneMenu value="#{abacusMB.kioskId}">
    <f:selectItem itemLabel="-Select-" itemValue="null"></f:selectItem>
    <f:selectItem itemLabel="1001" itemValue="1001"></f:selectItem>
    <f:selectItem itemLabel="1002" itemValue="1002"></f:selectItem>
    </p:selectOneMenu>
    <br></br>
    <h:outputLabel value="Kiosk Location"></h:outputLabel>
    <p:selectOneMenu value="#{abacusMB.location}">
    <f:selectItem itemLabel="-Select-" itemValue="null"></f:selectItem>
    <f:selectItem itemLabel="Nashik" itemValue="Nashik"></f:selectItem>
    <f:selectItem itemLabel="Lonavala" itemValue="Lonavala"></f:selectItem>
    </p:selectOneMenu>
    <br></br>
    <center>
    <p:commandButton value="Search" type="submit" actionListener="#{abacusMB.searchRecord}" update="seachResult"></p:commandButton>
    </center>
    <p:dataTable id="seachResult" rendered="#{abacusMB.recordFlag}" lazy="true" value="#{abacusMB.recordList}" var="record">
    <p:column headerText="User">
    <h:outputText value="#{record.userName}"></h:outputText>
    </p:column>
    <p:column headerText="KioskId">
    <h:outputText value="#{record.kioskId}"></h:outputText>
    </p:column>
    <p:column headerText="Location">
    <h:outputText value="#{record.location}"></h:outputText>
    </p:column>
    </p:dataTable>
    </h:body>
    </h:form>
    </html>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
  <display-name>Abacus</display-name>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>/faces/*</url-pattern>
  </servlet-mapping>
  <context-param>
    <param-name>primefaces.THEME</param-name>
    <param-value>bluesky</param-value>
  </context-param>
  <context-param>
        <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
    </context-param>
  <listener>
    <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
  </listener>
</web-app>

RecordVO.java

    package com.abacus.search.vo;

    import java.io.Serializable;


    public class RecordVO implements Serializable{

        private static final long serialVersionUID = 11L;
        private String location;
        private String kioskId;
        private String userName;

        public String getLocation() {
            return location;
        }

        public void setLocation(String location) {
            this.location = location;
        }

        public String getKioskId() {
            return kioskId;
        }

        public void setKioskId(String kioskId) {
            this.kioskId = kioskId;
        }

        public String getUserName() {
            return userName;
        }

        public void setUserName(String userName) {
            this.userName = userName;
        }
    }

算盘MB.java

    package com.abacus.search.managedbean;

    import java.io.Serializable;
    import java.util.ArrayList;
    import java.util.List;

    import com.abacus.search.vo.RecordVO;
    public class AbacusMB implements Serializable{

        private static final long serialVersionUID = 1L;
        private String location;
        private String kioskId;
        private boolean recordFlag;
        private List<RecordVO>recordList=new ArrayList<RecordVO>();

        public String getLocation() {
            return location;
        }

        public void setLocation(String location) {
            this.location = location;
        }

        public String getKioskId() {
            return kioskId;
        }

        public void setKioskId(String kioskId) {
            this.kioskId = kioskId;
        }

        public boolean isRecordFlag() {
            return recordFlag;
        }

        public void setRecordFlag(boolean recordFlag) {
            this.recordFlag = recordFlag;
        }

        public List<RecordVO> getRecordList() {
            return recordList;
        }

        public void setRecordList(List<RecordVO> recordList) {
            this.recordList = recordList;
        }
        public void searchRecord(){
            recordFlag=true;
            List<RecordVO> recordVOTempList=new ArrayList<RecordVO>();

            if(this.kioskId.equals("1001") && this.location.equals("Nashik")){
                System.out.println("User has selected kiosk id as 1001 and location as Nashik ");
                System.out.println("We will display two records to Nashik");
                for(int i=0;i<2;i++){
                    if(i==0){
                        RecordVO recordVO=new RecordVO();
                        recordVO.setKioskId(kioskId);
                        recordVO.setLocation(location);
                        recordVO.setUserName("Sumit");
                        recordVOTempList.add(recordVO);
                    }else{
                        RecordVO recordVO=new RecordVO();
                        recordVO.setKioskId(kioskId);
                        recordVO.setLocation(location);
                        recordVO.setUserName("Aniket");
                        recordVOTempList.add(recordVO);
                        }
                }

            }else{
                if(this.kioskId.equals("1002") && this.location.equals("Lonavala")){
                    System.out.println("User has selected kiosk id as 1002 and location as Lonavala ");
                    System.out.println("We will display two records to Lonavala");
                    for(int i=0;i<2;i++){
                        if(i==0){
                            RecordVO recordVO=new RecordVO();
                            recordVO.setKioskId(kioskId);
                            recordVO.setLocation(location);
                            recordVO.setUserName("Aarti");
                            recordVOTempList.add(recordVO);
                        }else{
                            RecordVO recordVO=new RecordVO();
                            recordVO.setKioskId(kioskId);
                            recordVO.setLocation(location);
                            recordVO.setUserName("Rachana");
                            recordVOTempList.add(recordVO);
                            }
                    }//close for loop

                }//close if loop
            }//close else
            System.out.println("Record Flag value:"+recordFlag);
            System.out.println("Temp List size="+recordVOTempList.size());
            this.recordList=recordVOTempList;

        }

    }//close class

假设用户只输入位置并且没有为 kiosk id 提供任何输入,那么在单击搜索按钮后显示的记录中不应显示 kiosk id 列。

如何实施?

我在想的一个解决方案是我将检查每个输入的值是否为空,并根据我将呈现相应的列。告诉我它是否正确?我的 bean 在视图范围内。

4

2 回答 2

1

尝试这个

<!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"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui">
<h:head>  
 <link rel="stylesheet" type="text/css" href="css/style.css" /></h:head>  

 <h:body>  

 <h:form id="form">
    <p:graphicImage value="images/Abacus.jpg" width="100%"></p:graphicImage> 
    <p:tabView id="tabView">  

    <p:tab id="tab1" title="Dashboard">  
        <h:panelGrid columns="2" cellpadding="10">  

        </h:panelGrid>  
    </p:tab>  

    <p:tab id="tab2" title="Search">  
    <center>
        <p:outputLabel value="Search Report" styleClass="sumit" ></p:outputLabel>
    </center>
    <p:panel> 

     <p:panelGrid columns="4" style="width:100%" >  

     <h:outputLabel value="Transaction Id:  " />  
       <p:inputMask value="#{abacusMB.transactionId}" mask="9999999999999999"> </p:inputMask>

     <h:outputLabel  value="Service Type:  " />  
       <p:selectOneMenu value="#{abacusMB.serviceType}">  
            <f:selectItem itemLabel="-Select-"/>
            <f:selectItem itemLabel="Deposit" itemValue="Deposit"></f:selectItem>  
       </p:selectOneMenu>  

     <h:outputLabel  value="Account Number:  " />  
       <p:inputMask value="#{abacusMB.accountNumber}" mask="9999999999999999"> </p:inputMask> 

     <h:outputLabel  value="Account Type:  " />  
       <p:selectOneMenu value="#{abacusMB.accountType}">  
            <f:selectItem itemLabel="ALL" itemValue="ALL"  />
            <f:selectItems  value="#{abacusMB.accTypes}"></f:selectItems>

       </p:selectOneMenu>  

    <h:outputLabel  value="Kiosk Location:  " />  
       <p:selectOneMenu value="#{abacusMB.kioskLocation}" >  
            <f:selectItem itemLabel="ALL" itemValue="ALL"  />  
            <f:selectItems value="#{abacusMB.kioskLocations}"/> 
            <p:ajax listener="#{abacusMB.onSelectLocation}" update="namelist"></p:ajax> 
       </p:selectOneMenu>   

       <h:outputLabel  value="Deposit Mode:  " />  
       <p:selectOneMenu value="#{abacusMB.depositMode}">  
            <f:selectItem itemLabel="-Select-"/>
            <f:selectItem itemLabel="Cash" itemValue="Cash"></f:selectItem>
            <f:selectItem itemLabel="Cheque" itemValue="Cheque"></f:selectItem>  
       </p:selectOneMenu>  

     <h:outputLabel  value="Kiosk Name:  " />  
       <p:selectOneMenu value="#{abacusMB.kioskName}" disabled="#{abacusMB.kioName}" id="namelist">  
            <f:selectItem itemLabel="ALL" itemValue="" />  
            <f:selectItems value="#{abacusMB.kname}" />  
            <p:ajax listener="#{abacusMB.onSelectName}" update="idlist"></p:ajax>
       </p:selectOneMenu>

     <h:outputLabel  value="Transaction Status:  " />  
       <p:selectOneMenu value="#{abacusMB.transactionStatus}">  
            <f:selectItem itemLabel="ALL" itemValue="" />  
            <f:selectItem itemLabel="Failed" itemValue="Failed" />  
            <f:selectItem itemLabel="Success" itemValue="Success" />  
       </p:selectOneMenu>

    <h:outputLabel  value="Kiosk Id:  " />  
     <p:selectOneMenu value="#{abacusMB.kioskId}" disabled="#{abacusMB.kioId}" id="idlist">  
            <f:selectItem itemLabel="ALL" itemValue="" />  
            <f:selectItems value="#{abacusMB.kid}" />  
     </p:selectOneMenu>

     <h:outputLabel  value="Batch Id:  " />  
     <p:selectOneMenu value="#{abacusMB.batchId}">  
            <f:selectItem itemLabel="ALL" itemValue="" />  
            <f:selectItems value="#{abacusMB.bid}" />  
     </p:selectOneMenu>

    <h:outputLabel  value="Start Date: " />
        <p:calendar value="#{abacusMB.startDate}" showOn="button" size="10" >  
    </p:calendar> 

    <h:outputLabel value="End Date: " />
       <p:calendar value="#{abacusMB.endDate}" showOn="button" size="10" required="true" requiredMessage="Please select End Date">  
    </p:calendar>    

     <h:outputLabel value="Get All Data:"></h:outputLabel>
      <h:selectBooleanCheckbox value="#{abacusMB.searchAll}" immediate="true" />
  </p:panelGrid>   
</p:panel> 

<center>
  <p:commandButton type="submit" value="Search" icon="ui-icon-check" style="margin:0" action="#{abacusMB.getSearchSubmit}" update=":form:datatbl" immediate="true"/> 
</center>
<br/><br/>
<p:dataTable  var="itr" value="#{abacusMB.searchReportList}"  rendered="#{abacusMB.showSearch}" id="datatbl" lazy="true" paginator="true" rows="5"  
                 paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"  
                 rowsPerPageTemplate="5,10,15" emptyMessage="No Records Found!!!">


<p:column headerText="Transaction ID"/>
<h:outputText value="#{itr.transId}" ></h:outputText>
<p:column headerText="Kiosk ID"/>
<h:outputText value="#{itr.kioskId}" ></h:outputText>
<p:column headerText="Account Number"/>
<h:outputText value="#{itr.accNumber}" ></h:outputText>
<p:column headerText="Transaction Code"/>
<h:outputText value="#{itr.transCode}" ></h:outputText>
<p:column headerText="Deposite Mode"/>
<h:outputText value="#{itr.depoMode}" ></h:outputText>
<p:column headerText="Deposite Amount"/>
<h:outputText value="#{itr.depoAmt}" ></h:outputText>
<p:column headerText="Denomination"/>
<h:outputText value="#{itr.denomination}" ></h:outputText>
<p:column headerText="Checque Number"/>
<h:outputText value="#{itr.chkNumber}" ></h:outputText>
<p:column headerText="MICR Code"/>
<h:outputText value="#{itr.micrCode}" ></h:outputText>
<p:column headerText="Note Count"/>
<h:outputText value="#{itr.noteCnt}" ></h:outputText>
<p:column headerText="Batch ID"/>
<h:outputText value="#{itr.batchId}" ></h:outputText>
<p:column headerText="Date"/>
<h:outputText value="#{itr.dt}" ></h:outputText>
<p:column headerText="Time"/>
<h:outputText value="#{itr.tym}" ></h:outputText>
<p:column headerText="Service Type"/>
<h:outputText value="#{itr.serviceType}" ></h:outputText>
<p:column headerText="Account Type"/>
<h:outputText value="#{itr.accType}" ></h:outputText>
<p:column headerText="Kiosk Name"/>
<h:outputText value="#{itr.kioskName}" ></h:outputText>
<p:column headerText="City"/>
<h:outputText value="#{itr.city}" ></h:outputText>
<p:column headerText="State"/>
<h:outputText value="#{itr.state}" ></h:outputText>
<p:column headerText="Country"/>
<h:outputText value="#{itr.country}" ></h:outputText>

</p:dataTable>

    </p:tab>  

    <p:tab id="tab3" title="Monthly Report">  
        <h:panelGrid columns="2" cellpadding="10">  
        </h:panelGrid>  
    </p:tab>  
  <p:tab id="tab4" title="EOD Report">  
<center>
    <p:outputLabel value="EOD Summary Report" styleClass="sumit" ></p:outputLabel></center>
  <p:panel> 
          <p:panelGrid columns="4" style="width:100%" >  
        <h:outputLabel value="Kiosk Circle:  " />  
     <p:selectOneMenu styleClass="selectMenu">  
            <f:selectItem itemLabel="ALL" itemValue="" />  
            <f:selectItem itemLabel="Option 1" itemValue="1" />  
            <f:selectItem itemLabel="Option 2" itemValue="2" />  
            <f:selectItem itemLabel="Option 3" itemValue="3" />  
        </p:selectOneMenu>  
         <h:outputLabel  value="Payment Mode:  " />  
     <p:selectOneMenu styleClass="selectMenu">  
            <f:selectItem itemLabel="ALL" itemValue="" />  
            <f:selectItem itemLabel="Option 1" itemValue="1" />  
            <f:selectItem itemLabel="Option 2" itemValue="2" />  
            <f:selectItem itemLabel="Option 3" itemValue="3" />  
        </p:selectOneMenu>  
         <h:outputLabel  value="Kiosk Name:  " />

     <p:selectOneMenu value="#{abacusMB.userName}" styleClass="selectMenu">  
            <f:selectItem itemLabel="ALL" itemValue="" />  
            <f:selectItems value="#{abacusMB.users}"></f:selectItems>
        </p:selectOneMenu>  
     <h:outputLabel  value="Batch Id:  " />  
     <p:selectOneMenu styleClass="selectMenu">  
            <f:selectItem itemLabel="ALL" itemValue="" />  
            <f:selectItem itemLabel="Option 1" itemValue="1" />  
            <f:selectItem itemLabel="Option 2" itemValue="2" />  
            <f:selectItem itemLabel="Option 3" itemValue="3" />  
        </p:selectOneMenu>
     <h:outputLabel  value="Service:  " />  
     <p:selectOneMenu styleClass="selectMenu">  
            <f:selectItem itemLabel="ALL" itemValue=""  />  
            <f:selectItem itemLabel="Option 1" itemValue="1" />  
            <f:selectItem itemLabel="Option 2" itemValue="2" />  
            <f:selectItem itemLabel="Option 3" itemValue="3" />  
      </p:selectOneMenu>
      <h:outputLabel  value="Start Date: " />
       <p:calendar value="#{abacusMB.startDate}" showOn="button" size="10" >  
    </p:calendar> 
    <h:outputLabel value="End Date: " />
       <p:calendar value="#{abacusMB.startDate}" showOn="button" size="10" required="true" requiredMessage="Please select End Date">  
    </p:calendar>    

</p:panelGrid> </p:panel> 

<center>
  <p:commandButton type="submit" value="Search" icon="ui-icon-check" style="margin:0" action="#{abacusMB.getEODReport}" update="@form" immediate="true"/> 

</center>
</p:tab>  
  <p:tab id="tab5" title="Custom View">  
        <h:panelGrid columns="2" cellpadding="10">  
        </h:panelGrid>  
    </p:tab>  
   <p:tab id="tab7" title="Log Off">  
        <h:panelGrid columns="2" cellpadding="10">  
        </h:panelGrid>  
    </p:tab>  

</p:tabView>  

<p:panel id="Results">
<p:dataTable value="#{abacusMB.eodReport}" var="itr" rendered="true" emptyMessage="No Records Found!!!" id="record">
<p:column headerText="Kiosk Circle"/>
<h:outputText value="#{itr.circle}" ></h:outputText>
<p:column headerText="Kiosk Name"/>
<h:outputText value="#{eod.getName}"></h:outputText>
<p:column headerText="Kiosk Service"/>
<h:outputText value="#{eod.service}"></h:outputText>
</p:dataTable>
</p:panel>
 </h:form>  
 </h:body>  
</html>
于 2012-11-25T13:31:36.663 回答
0

BeanClass 为它

/**
 * 
 */
package com.everest.managedbean;


//use control+alt+o for auto package update
import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

import org.primefaces.event.DateSelectEvent;

import com.everest.dao.DbManager;
import com.everest.vo.ResultVO;


import com.everest.vo.SearchVO;


/**
 * @author ANIKET
 *
 */
public class AbacusMB implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private String accountNumber;
    private String accountType;
    private List<String>accTypes;
    private String transactionId;
    private String serviceType;
    private String kioskLocation;
    private List<String> kioskLocations;
    private String kioskId;
    private List<String>kid;
    private boolean kioId=true;
    private String batchId;
    private List<String>bid;
    private String depositMode;
    private String kioskName;
    private List<String>kname;
    private boolean kioName=true;
    private String transactionStatus;
    private String userName;
    private List<String>users;

    private Date startDate;
    private Date endDate;

    private List<ResultVO>eodReport;
    private boolean showEOD=false;

    private List<SearchVO>searchReportList;
    private boolean showSearch=false;
    private boolean searchAll=false;

    DbManager db=DbManager.getDbobject();
    Statement stmt;

    public AbacusMB() {
        this.eodReport=new ArrayList<ResultVO>();
        // TODO Auto-generated constructor stub
    }
    /**
     * @return the users
     * @throws SQLException 
     */
    public List<String> getUsers() throws SQLException {

//        stmt=db.con.createStatement();
//        ResultSet rs=stmt.executeQuery("select * from abacus_user");
//        users=new ArrayList<String>();
//        while(rs.next())
//        {
//          users.add(rs.getString("name"));
//        }

        return users;
    }

    /**
     * @param users the users to set
     */
    public void setUsers(List<String> users) {
        this.users = users;
    }

    /**
     * @return the userName
     */
    public String getUserName() {
        return userName;
    }

    /**
     * @param userName the userName to set
     */
    public void setUserName(String userName) {
        this.userName = userName;
    }
     public void handleDateSelect(DateSelectEvent event) {  
            FacesContext facesContext = FacesContext.getCurrentInstance();  
            SimpleDateFormat format = new SimpleDateFormat("d/M/yyyy");  
            facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Date Selected", format.format(event.getDate())));  
     }

    /**
     * @return the startDate
     */
    public Date getStartDate() {
        return startDate;
    }

    /**
     * @param startDate the startDate to set
     */
    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    /**
     * @return the endDate
     */
    public Date getEndDate() {
        return endDate;
    }

    /**
     * @param endDate the endDate to set
     */
    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }  
    public void getEODReport(){
    eodReport=new ArrayList<ResultVO>();
    System.out.println("Inside EOD Report");
    showEOD=true;
    ResultVO r1=new ResultVO();
    r1.setCircle("Gangapur Naka");
    r1.setName("Airtel");
    r1.setService("PrePaid");
    ResultVO r2=new ResultVO();
    r1.setCircle("Sanghvi");
    r1.setName("TataDocomo");
    r1.setService("PostPaid");
    eodReport.add(r1);
    eodReport.add(r2);
    this.setEodReport(eodReport);
    System.out.println("Size of eodReportVO: "+eodReport.size());
    }

    /**
     * @return the eodReport
     */
    public List<ResultVO> getEodReport() {

        return eodReport;
    }

    /**
     * @param eodReport the eodReport to set
     */
    public void setEodReport(List<ResultVO> eodReport) {
        this.eodReport = eodReport;
    }

    /**
     * @return the showEOD
     */
    public boolean isShowEOD() {
        return showEOD;
    }

    /**
     * @param showEOD the showEOD to set
     */
    public void setShowEOD(boolean showEOD) {
        this.showEOD = showEOD;
    }

    /**
     * @return the depositMode
     */
    public String getDepositMode() {
        return depositMode;
    }

    /**
     * @param depositMode the depositMode to set
     */
    public void setDepositMode(String depositMode) {
        this.depositMode = depositMode;
    }


    /**
     * @param serviceType the serviceType to set
     */
    public void setServiceType(String serviceType) {
        this.serviceType = serviceType;
    }

    /**
     * @return the serviceType
     */
    public String getServiceType() {
        return serviceType;
    }

    /**
     * @return the searchAll
     */
    public boolean isSearchAll() {
        return searchAll;
    }

    /**
     * @param searchAll the searchAll to set
     */
    public void setSearchAll(boolean searchAll) {
        this.searchAll = searchAll;
        if(searchAll){
            System.out.println("Get All Data is selected");
        }
        else{
            System.out.println("Get All Data is not selected");
        }
    }
    /**
     * @return the accountNumber
     */
    public String getAccountNumber() {
        return accountNumber;
    }
    /**
     * @param accountNumber the accountNumber to set
     */
    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }
    /**
     * @return the kioskLocation
     */
    public String getKioskLocation() {
        return kioskLocation;
    }
    /**
     * @param kioskLocation the kioskLocation to set
     */
    public void setKioskLocation(String kioskLocation) {
        this.kioskLocation = kioskLocation;
    }
    /**
     * This list is used ton populate Kiosk Location dropdown list
     * @return the kioskLocations
     * @throws SQLException 
     */
    public List<String> getKioskLocations() throws SQLException {

        kioskLocations=new ArrayList<String>();
        stmt=db.con.createStatement();
        ResultSet rs=stmt.executeQuery("select city from kiosk_master_tbl");
        while(rs.next())
        {
            kioskLocations.add(rs.getString(1));
        }
        return kioskLocations;
    }
    /**
     * @param kioskLocations the kioskLocations to set
     */
    public void setKioskLocations(List<String> kioskLocations) {
        this.kioskLocations = kioskLocations;
    }
    /**
     * @return the transactionStatus
     */
    public String getTransactionStatus() {
        return transactionStatus;
    }
    /**
     * @param transactionStatus the transactionStatus to set
     */
    public void setTransactionStatus(String transactionStatus) {
        this.transactionStatus = transactionStatus;
    }

    /**
     * @return the accTypes
     */
    public List<String> getAccTypes() {
        accTypes=new ArrayList<String>();
            accTypes.add("Saving");
            accTypes.add("Current");

        return accTypes;
    }
    /**
     * @param accTypes the accTypes to set
     */
    public void setAccTypes(List<String> accTypes) {
        this.accTypes = accTypes;
    }
    /**
     * @return the accountType
     */
    public String getAccountType() {
        return accountType;
    }
    /**
     * @param accountType the accountType to set
     */
    public void setAccountType(String accountType) {
        this.accountType = accountType;
    }
    /**
     * @return the kioskName
     */
    public String getKioskName() {
        return kioskName;
    }
    /**
     * @param kioskName the kioskName to set
     */
    public void setKioskName(String kioskName) {
        this.kioskName = kioskName;
    }
    /**
     * @return the kname
     * @throws SQLException 
     */
    public List<String> getKname() throws SQLException {


        return kname;
    }
    /**
     * @param kname the kname to set
     */
    public void setKname(List<String> kname) {
        this.kname = kname;
    }

    /**
     * @return the transactionId
     */
    public String getTransactionId() {
        return transactionId;
    }
    /**
     * @param transactionId the transactionId to set
     */
    public void setTransactionId(String transactionId) {
        this.transactionId = transactionId;
    }
    /**
     * @return the kioskId
     */
    public String getKioskId() {
        return kioskId;
    }
    /**
     * @param kioskId the kioskId to set
     */
    public void setKioskId(String kioskId) {
        this.kioskId = kioskId;
    }
    /**
     * @return the kid
     * @throws SQLException 
     */
    public List<String> getKid() throws SQLException {


        return kid;
    }
    /**
     * @param kid the kid to set
     */
    public void setKid(List<String> kid) {
        this.kid = kid;
    }
    /**
     * @return the batchId
     */
    public String getBatchId() {
        return batchId;
    }
    /**
     * @param batchId the batchId to set
     */
    public void setBatchId(String batchId) {
        this.batchId = batchId;
    }
    /**
     * @return the bid
     * @throws SQLException 
     */
    public List<String> getBid() throws SQLException {
        bid=new ArrayList<String>();
        stmt=db.con.createStatement();
        ResultSet rs=stmt.executeQuery("select batchid from batch_info_tbl");
        while(rs.next())
        {
            bid.add(rs.getString(1));
        }
        return bid;
    }
    /**
     * @param bid the bid to set
     */
    public void setBid(List<String> bid) {
        this.bid = bid;
    }
    public void setKioName(boolean kioName) {
        this.kioName = kioName;
    }
    public boolean isKioName() {
        return kioName;
    }
    /**
     * @return the kioId
     */
    public boolean isKioId() {
        return kioId;
    }
    /**
     * @param kioId the kioId to set
     */
    public void setKioId(boolean kioId) {
        this.kioId = kioId;
    }

    public void onSelectLocation() throws SQLException
    {
        if(kioskLocation!=null)
        {
            kioName=false;
            kname=new ArrayList<String>();
            stmt=db.con.createStatement();
            ResultSet rs=stmt.executeQuery("select kioskname from kiosk_master_tbl where city='"+kioskLocation+"'" );
            while(rs.next())
            {
                kname.add(rs.getString(1));
            }
        }
    }

    public void onSelectName() throws SQLException
    {
        if(kioskName!=null)
        {
            kioId=false;
            stmt=db.con.createStatement();
            ResultSet rs=stmt.executeQuery("select kioskid from kiosk_master_tbl where kioskname='"+kioskName+"'");
            kid=new ArrayList<String>();
            while(rs.next())
            {
                kid.add(rs.getString(1));
            }
        }
    }

    public void getSearchSubmit() throws SQLException
    {
        int i=0;
        System.out.println("Inside search");
        showSearch=true;
        stmt=db.con.createStatement();
        searchReportList=new ArrayList<SearchVO>();
        ResultSet rs=stmt.executeQuery("SELECT * FROM (SELECT ct.transactionid,ct.kioskid,ct.AccountNumber,ct.TransactionCode,ct.DepositeMode,ct.DepositeAmount,ct.Denomination,ct.ChequeNumber,ct.MICRCode,ct.NoteCount,ct.BatchId,ct.Dt,ct.Tym,ct.ServiceType,ct.AccountType,kmt.kioskname,kmt.city,kmt.state,kmt.country FROM kiosk_master_tbl AS kmt ,customer_transaction AS ct WHERE ct.kioskid=kmt.kioskid) AS newtbl WHERE newtbl.AccountType='"+accountType+"' ");

        while(rs.next())
        {
            i++;
            SearchVO vo=new SearchVO();

            vo.setTransId(rs.getString(1));
            vo.setKioskId(rs.getString(2));
            vo.setAccNumber(rs.getString(3));
            vo.setTransCode(rs.getString(4));
            vo.setDepoMode(rs.getString(5));
            vo.setDepoAmt(rs.getString(6));
            vo.setDenomination(rs.getString(7));
            vo.setChkNumber(rs.getString(8));
            vo.setMicrCode(rs.getString(9));
            vo.setNoteCnt(rs.getString(10));
            vo.setBatchId(rs.getString(11));
            vo.setDt(rs.getString(12));
            vo.setTym(rs.getString(13));
            vo.setServiceType(rs.getString(14));
            vo.setAccType(rs.getString(15));
            vo.setKioskName(rs.getString(16));
            vo.setCity(rs.getString(17));
            vo.setState(rs.getString(18));
            vo.setCountry(rs.getString(19));
            searchReportList.add(vo);
        }
        this.setSearchReportList(searchReportList);
        System.out.println("No. Of Record:- "+i);
        System.out.println("Size of SearchVO: "+searchReportList.size());
    }
    /**
     * @return the showSearch
     */
    public boolean isShowSearch() {
        return showSearch;
    }
    /**
     * @param showSearch the showSearch to set
     */
    public void setShowSearch(boolean showSearch) {
        this.showSearch = showSearch;
    }
    /**
     * @return the searchReportList
     */
    public List<SearchVO> getSearchReportList() {
        return searchReportList;
    }
    /**
     * @param searchReportList the searchReportList to set
     */
    public void setSearchReportList(List<SearchVO> searchReportList) {
        this.searchReportList = searchReportList;
    }
}

// 样式类

@CHARSET "ISO-8859-1";
.sumit{
color:blue; 
}

.selectCalendarMenu{
width:50%;  
}

//值对象类

public class SearchVO implements Serializable{
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private String transId;
    private String kioskId;
    private String accNumber;
    private String transCode;
    private String depoMode;
    private String depoAmt;
    private String denomination;
    private String chkNumber;
    private String micrCode;
    private String noteCnt;
    private String batchId;
    private String serviceType;
    private String accType;
    private String kioskName;
    private String dt;
    private String tym;
    private String city;
    private String state;
    private String country;
    /**
     * @return the transId
     */
    public String getTransId() {
        return transId;
    }
    /**
     * @param transId the transId to set
     */
    public void setTransId(String transId) {
        this.transId = transId;
    }
    /**
     * @return the kioskId
     */
    public String getKioskId() {
        return kioskId;
    }
    /**
     * @param kioskId the kioskId to set
     */
    public void setKioskId(String kioskId) {
        this.kioskId = kioskId;
    }
    /**
     * @return the accNumber
     */
    public String getAccNumber() {
        return accNumber;
    }
    /**
     * @param accNumber the accNumber to set
     */
    public void setAccNumber(String accNumber) {
        this.accNumber = accNumber;
    }
    /**
     * @return the transCode
     */
    public String getTransCode() {
        return transCode;
    }
    /**
     * @param transCode the transCode to set
     */
    public void setTransCode(String transCode) {
        this.transCode = transCode;
    }
    /**
     * @return the depoMode
     */
    public String getDepoMode() {
        return depoMode;
    }
    /**
     * @param depoMode the depoMode to set
     */
    public void setDepoMode(String depoMode) {
        this.depoMode = depoMode;
    }
    /**
     * @return the depoAmt
     */
    public String getDepoAmt() {
        return depoAmt;
    }
    /**
     * @param depoAmt the depoAmt to set
     */
    public void setDepoAmt(String depoAmt) {
        this.depoAmt = depoAmt;
    }
    /**
     * @return the denomination
     */
    public String getDenomination() {
        return denomination;
    }
    /**
     * @param denomination the denomination to set
     */
    public void setDenomination(String denomination) {
        this.denomination = denomination;
    }
    /**
     * @return the chkNumber
     */
    public String getChkNumber() {
        return chkNumber;
    }
    /**
     * @param chkNumber the chkNumber to set
     */
    public void setChkNumber(String chkNumber) {
        this.chkNumber = chkNumber;
    }
    /**
     * @return the micrCode
     */
    public String getMicrCode() {
        return micrCode;
    }
    /**
     * @param micrCode the micrCode to set
     */
    public void setMicrCode(String micrCode) {
        this.micrCode = micrCode;
    }
    /**
     * @return the noteCnt
     */
    public String getNoteCnt() {
        return noteCnt;
    }
    /**
     * @param noteCnt the noteCnt to set
     */
    public void setNoteCnt(String noteCnt) {
        this.noteCnt = noteCnt;
    }
    /**
     * @return the batchId
     */
    public String getBatchId() {
        return batchId;
    }
    /**
     * @param batchId the batchId to set
     */
    public void setBatchId(String batchId) {
        this.batchId = batchId;
    }
    /**
     * @return the serviceType
     */
    public String getServiceType() {
        return serviceType;
    }
    /**
     * @param serviceType the serviceType to set
     */
    public void setServiceType(String serviceType) {
        this.serviceType = serviceType;
    }
    /**
     * @return the accType
     */
    public String getAccType() {
        return accType;
    }
    /**
     * @param accType the accType to set
     */
    public void setAccType(String accType) {
        this.accType = accType;
    }
    /**
     * @return the kioskName
     */
    public String getKioskName() {
        return kioskName;
    }
    /**
     * @param kioskName the kioskName to set
     */
    public void setKioskName(String kioskName) {
        this.kioskName = kioskName;
    }
    /**
     * @return the dt
     */
    public String getDt() {
        return dt;
    }
    /**
     * @param dt the dt to set
     */
    public void setDt(String dt) {
        this.dt = dt;
    }
    /**
     * @return the tym
     */
    public String getTym() {
        return tym;
    }
    /**
     * @param tym the tym to set
     */
    public void setTym(String tym) {
        this.tym = tym;
    }
    /**
     * @return the city
     */
    public String getCity() {
        return city;
    }
    /**
     * @param city the city to set
     */
    public void setCity(String city) {
        this.city = city;
    }
    /**
     * @return the state
     */
    public String getState() {
        return state;
    }
    /**
     * @param state the state to set
     */
    public void setState(String state) {
        this.state = state;
    }
    /**
     * @return the country
     */
    public String getCountry() {
        return country;
    }
    /**
     * @param country the country to set
     */
    public void setCountry(String country) {
        this.country = country;
    }

}
于 2012-11-25T13:54:39.763 回答