Yes,I think you are right,follow is the relate source files

=================== CustomerList.tml========================

<t:pagelayout t:pageTitle="${message:label_pageTitle}"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
<head>
</head>
<body>
<t:form t:id="customerListForm" > 
        <table>
                <tr>
                        <td align="left">
                                ${message:label_searchTitle}:<input
type="text" t:type="TextField" t:value="searchKey" />
                                <input type="submit" t:type="Submit"
t:id="button_search"  value="${message:button_Search}" />
                        </td>
                </tr>
                <tr>
                        <td>
                                <t:grid t:source="allCustomers"
rowsPerPage="5" pagerPosition="bottom"  
        
exclude="CustomerCode,customerDestCode,controlSaleDept,controlSale"
        
reorder="customerName,customerTel,customerLocation,customerPost"/>
        
                        </td>
                </tr>
        </table>
</t:form>
</body>
</t:pagelayout>



================== CustomerList.java=======================

package com.sacf.viewlayer.web.pages.securePage;

import com.sacf.servicelayer.iface.*;
import org.apache.tapestry.ioc.annotations.Inject;
import org.apache.tapestry.annotations.Service;
import com.sacf.domain.model.CustomerInfo;

import java.util.List;

public class CustomerList {
        
        
        private String searchKey;
        
        public void setSearchKey(String searchKey){
                this.searchKey=searchKey;
        }
        public String getSearchKey(){
                return searchKey;
        }
        
        
        @Inject
        @Service("customerManager")
        private CustomerManager customerManager;
        
        public List<CustomerInfo> getAllCustomers(){
                System.out.println("you input the key is:"+searchKey);
                if(searchKey==null||searchKey.equals("") ){
                        return customerManager.getCustomers();
                }
                else{
                        return customerManager.search(searchKey);
                }
        }
        

}


===============CustomerManagerImpl.java==========


package com.sacf.servicelayer.impl;

import java.util.List;

import com.sacf.domain.model.CustomerInfo;
import com.sacf.servicelayer.iface.CustomerManager;

import com.sacf.domain.dao.CustomerDao;

public class CustomerManagerImpl implements CustomerManager {
        
        private CustomerDao customerDao;
        
        public void setCustomerDao(CustomerDao customerDao){
                this.customerDao=customerDao;
        }

        public void deleteCustomer(CustomerInfo custObj) {
                customerDao.deleteCustomer(custObj);

        }

        public List<CustomerInfo> getCustomers() {              
                return customerDao.getCustomerList();
        }

        public void saveCustomer(CustomerInfo custObj) {
                customerDao.saveorupdateCustomer(custObj);
        }

        public List<CustomerInfo> search(String searchKey) {            
                return customerDao.search(searchKey);
        }

}



=================CustomerDaoImpl.java=====================


package com.sacf.domain.dao.hibernate;

import java.util.List;

import com.sacf.domain.dao.CustomerDao;
import com.sacf.domain.model.CustomerInfo;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.hibernate.Query;
import org.springframework.dao.DataAccessException;

public class CustomerDaoImpl extends HibernateDaoSupport implements
CustomerDao {

        public void deleteCustomer(CustomerInfo customerObj) {
                try{
                        Session
session=getHibernateTemplate().getSessionFactory().openSession();
                        session.delete(customerObj);
                }
                catch(DataAccessException e){
                        e.printStackTrace();
                }

        }

        public List<CustomerInfo> getCustomerList() {
                try{
                        Session
session=getHibernateTemplate().getSessionFactory().openSession();
                        Query query=session.createQuery("from
CustomerInfo");
                        return query.list();
                        
                
                        
                }
                catch(DataAccessException e){
                        return null;
                }
        }

        public void saveorupdateCustomer(CustomerInfo cust) {
                getHibernateTemplate().save(cust);

        }

        public List<CustomerInfo> search(String searchKey) {
                try{
                        Session
session=getHibernateTemplate().getSessionFactory().openSession();
                        Query query=session.createQuery("from CustomerInfo
where customerName like :p_customerName");
                        query.setParameter("p_customerName",
"%"+searchKey+"%");
                        return query.list();
                        
                
                        
                }
                catch(DataAccessException e){
                        return null;
                }
        }



}




When I press the search button,the search have no any error information,and
the return page only have the follow information: 

An unexpected application exception has occurred.
 Index: 4, Size: 4




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to