[u]1.新闻发布系统截图---JSF+EJB3.0[/u]
[img]http://hiphotos.baidu.com/kennylin2008/pic/item/f123241b092c39e3ae513345.jpg[/img]
[img]http://photo.store.qq.com/http_imgload.cgi?/rurl2=25a6d507727c86f1b61c930cadd6760da7b9ae25c991d4ef07e3da7c5eb1de658184dff9602f73d02d940e56cf76de805f2193a81218e7ad4f9f024d07dd403d4d5ecc768d65719d1fd2bbb8729240698b9f761a[/img]
[img]http://photo.store.qq.com/http_imgload.cgi?/rurl2=8c90dda1511f6040faf6bb98cc893d04a352e46c0c39169c1e7cddad254fdfdb1539f64131c11ebe508fa89fd4b458bb23232b6a73bca4721d2bc8dec4573b4e797cc6954cc1f3547e53ab5fb8492bd5e774f858[/img]
2.实验室设备管理系统---JSF(Tomahawk)+Spring2.0+Hibernate3.2
[img]http://photo.store.qq.com/http_imgload.cgi?/rurl2=74627c4b70e23d99d1e92207645b37139535214572f5806f25ae249aca0c835660a96b3bd8ebb115e9f0de34ac314d936f97455b170fe22050bf84fbdac33a995ce9c4a847c2e1528603365053f0cb887942adc9[/img]
[img]http://photo.store.qq.com/http_imgload.cgi?/rurl2=ca8eed43dd45427418c84772b9e6143d4e179406e51b2549e055ed73b46caa7216c9fdf3669f3ea73efc792fc04e7e47e55e56b445067f274d998c912e4c5d484091ea483b638c8c68b6acade2c73aed30f0e859[/img]
[img]http://photo.store.qq.com/http_imgload.cgi?/rurl2=7274cf4ca216cc2beaca21d0d3da73dcffc589c2c32cc106a2591bd1dd464438e8b6d566d95da469df70bd6af7083963603b7cd56fbf520b8812ee52d64208d674918e7797903094f626a3ff1dd11520ce718130[/img]
[img]http://photo.store.qq.com/http_imgload.cgi?/rurl2=537836532c33b660a99d9882168fe153c7714923fd9f411f014a213bdf9b9e91c5ddf409959c2c590ed59772668b3b64e04f1775d1f4cbf8b5b7c4085c952a511d435491e78a9ebe0557a4b21494c41270c13d83[/img]
[img]http://photo.store.qq.com/http_imgload.cgi?/rurl2=2b15df886d6993a8010c7b55291c5eeb9b52e185722acaeaed4faad48600f70161787ee26a14ab70b8b77cb8f58f68b2f3c4a816b516855c4753c925528622986156b12739bbb3196a99f089098e9236b71a18fe[/img]
[img]http://photo.store.qq.com/http_imgload.cgi?/rurl2=300a7bff9159e93c348d218cb75f1d9bdf8144496a45622d20c80a96fbfa69356ac3a0be2f1696e8d3c6e3a30263d2419d716610f4c93664151652cfb73cf2aff2684603367b5c4a3d97236ee3034a0e893b0a56[/img]
我设计的部分超类:
/*
* 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
[img]http://photo.store.qq.com/http_imgload.cgi?/rurl2=d1c2f68b4aa4625f61a04530cfc023bc3764e0497660311e4a14426b96b39585d5187d9c95ef852e680d0a0f857075076c17fb5e29af11689a033e9b42310690dfa7e0c3cd78d6dc29220f6f0f53bcb9a8d94e3b[/img]