我新闻发布系统和实验室设备管理系统截图

阅读更多
1.新闻发布系统截图---JSF+EJB3.0
我新闻发布系统和实验室设备管理系统截图_第1张图片
我新闻发布系统和实验室设备管理系统截图_第2张图片
我新闻发布系统和实验室设备管理系统截图_第3张图片
2.实验室设备管理系统---JSF(Tomahawk)+Spring2.0+Hibernate3.2
我新闻发布系统和实验室设备管理系统截图_第4张图片

我新闻发布系统和实验室设备管理系统截图_第5张图片
我新闻发布系统和实验室设备管理系统截图_第6张图片
我新闻发布系统和实验室设备管理系统截图_第7张图片
我新闻发布系统和实验室设备管理系统截图_第8张图片
我新闻发布系统和实验室设备管理系统截图_第9张图片

我设计的部分超类:
/*
* EntityManagerDAOImpl.java
*
* Created on 2007年10月6日, 下午2:29
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

package org.dgut.lab.model.dao.impl;

import java.sql.SQLException;
import java.util.List;
import org.dgut.lab.model.dao.EntityManagerDAO;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.orm.hibernate3.HibernateTemplate;

/**
*
* @author LinChunyu
*/
public class EntityManagerDAOImpl implements EntityManagerDAO{
    private HibernateTemplate hibernateTemplate;
    /** Creates a new instance of EntityManagerDAOImpl */
    public EntityManagerDAOImpl() {
    }
   
    public void delete(Object persistentInstance) {
        hibernateTemplate.delete(persistentInstance);
    }
   
    public Object findById(Class cl,int id) {
       
        return  hibernateTemplate.get(cl, id);
       
    }
   
    public Object merge(Object detachedInstance) {
        return   hibernateTemplate.merge(detachedInstance);
    }
   
    public void persist(Object transientInstance) {
        hibernateTemplate.persist(transientInstance);
    }
   
    public List execute(final String qry,final Object[] p) {
       
        List list=(List)hibernateTemplate.execute(new HibernateCallback(){
           
            public Object doInHibernate(Session session)
            throws HibernateException, SQLException {
                List list = null;
                Query q = session.createQuery(qry);
               
                if(p!=null){
                    for (int i = 0; i < p.length; i++) {
                        q.setParameter(i, p[i]);
                    }
                }
               
                return list = q.list();
            }
           
        });
        return list;
    }
   
    public List execute(final String qry,final Object[] p,final int batchSize,final int firstItem) {
       
        List list=(List)hibernateTemplate.execute(new HibernateCallback(){
           
            public Object doInHibernate(Session session)
            throws HibernateException, SQLException {
                List list = null;
                Query q = session.createQuery(qry);
                if(p!=null){
                    for (int i = 0; i < p.length; i++) {
                        q.setParameter(i, p[i]);
                    }
                }
                q.setMaxResults(batchSize);
                q.setFirstResult(firstItem);
                return list = q.list();
            }
           
        });
        return list;
    }
    public void setSessionFactory(SessionFactory sessionFactory) {
        this.hibernateTemplate = new HibernateTemplate(sessionFactory);
    }
   
}



package org.dgut.lab.view.controller;


import java.util.Locale;
import java.util.ResourceBundle;
import java.util.logging.Logger;

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

import org.dgut.lab.model.servicelocator.ServiceLocator;

public class BaseController {
   
    protected ServiceLocator serviceLocator;
   
    protected final Logger log = Logger.getLogger(this.getClass().getName());
   
    private int command=0;
   
    protected int pageNo=1;
   
    protected long itemCount;
   
    protected int totalPage;
   
    protected int batchSize=4;
   
    public BaseController() {
       
    }
   
    public void init() {
       
    }
   
    public void setServiceLocator(ServiceLocator newServiceLocator) {
        this.serviceLocator = newServiceLocator;
        init();
    }
   
    public static void addErrorMessage(String msg1) {
        String msg=getMessageString(msg1);
        FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR,
                msg, msg);
        FacesContext fc = FacesContext.getCurrentInstance();
        fc.addMessage(null, facesMsg);
    }
   
    public static void addSuccessMessage(String msg1) {
        String msg=getMessageString(msg1);
        FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO,
                msg, msg);
        FacesContext fc = FacesContext.getCurrentInstance();
        fc.addMessage("successInfo", facesMsg);
    }
    public  static String getMessageString(String name) {
        String str = "";
        FacesContext facesContext = FacesContext.getCurrentInstance();
        String bundleName = facesContext.getApplication().getMessageBundle();
        if (bundleName != null) {
            Locale locale = facesContext.getViewRoot().getLocale();
            /*ResourceBundle bundle = ResourceBundle.getBundle(bundleName,
                    locale, getCurrentClassLoader(params));*/
           
            ResourceBundle bundle = ResourceBundle.getBundle(bundleName,
                    locale);
           
            /*ResourceBundle bundle = ResourceBundle.getBundle(bundleName,
                    locale, getCurrentClassLoader(params));*/
            str = bundle.getString(name);
        }
        return str;
    }
   
    private static ClassLoader getCurrentClassLoader(Object params) {
        return params.getClass().getClassLoader();
    }
   
    public long getItemCount() {
        return this.itemCount;
    }
   
    public int getPageNo() {
        return pageNo;
    }
   
    public int getTotalPage() {
        long totalPage1 = getItemCount() % 20 == 0 ? getItemCount() /batchSize
                : getItemCount() / batchSize + 1;
        totalPage=Integer.parseInt(String.valueOf(totalPage1));
        return this.totalPage;
    }
   
    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }
   
    public void setItemCount(long itemCount) {
        this.itemCount = itemCount;
    }

    public int getCommand() {
        return command;
    }

    public void setCommand(int command) {
        this.command = command;
    }
}

Spring配置文件

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
   
   
   
       
            com.mysql.jdbc.Driver
       

       
            jdbc:mysql://localhost:3306/devicemanage
       

       
            root
       

       
            123456
       

        10
        5
        30
        5
        10
        0
   

   
   
              class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
       
           
       

       
           
               
                    org.hibernate.dialect.MySQLDialect
               

               
                    true
               

           

       

       
           
                org/dgut/lab/model/entity/Voucher.hbm.xml
                org/dgut/lab/model/entity/Device.hbm.xml
                org/dgut/lab/model/entity/User.hbm.xml
                org/dgut/lab/model/entity/VoucherDevice.hbm.xml
                org/dgut/lab/model/entity/ManageLog.hbm.xml
                org/dgut/lab/model/entity/Country.hbm.xml
                org/dgut/lab/model/entity/PowerList.hbm.xml
           

       

   

   
   
              class="org.springframework.orm.hibernate3.HibernateTransactionManager">
       
   

   
   
   
       
           
           
           
           
       

   

   
   
                              expression="execution(* org.dgut.lab.model.service.*Service.*(..))" />
                             pointcut-ref="fooServiceOperation" />
       
   

   
   
              class="org.dgut.lab.model.servicelocator.ServiceLocatorImpl">
       
       
           
       

       
       
           
       

       
       
           
       

       
   

   
   


              class="org.dgut.lab.model.dao.impl.EntityManagerDAOImpl">
       
           
       

   

   
   
  
  
              class="org.dgut.lab.model.service.impl.DeviceServiceImpl">
       
           
       

   

   
              class="org.dgut.lab.model.service.impl.LoanServiceImpl">
       
           
       

   

              class="org.dgut.lab.model.service.impl.UserServiceImpl">
       
           
       

   



3.数据库查询分析处理器---RMI+JDBC+Swing
我新闻发布系统和实验室设备管理系统截图_第10张图片

你可能感兴趣的:(配置管理,QQ,Hibernate,CGI,JSF)