Expert One-On-One Oracle(中文版)
Thomas大师的大作,英文名叫Expert One-On-One Oracle,中文翻译名叫Oracle专家高级编程,袁勤勇、张玉魁翻译,PDF扫描版,有大量SQL*PLUS脚本示例,帮助理解Oracle数据库原理,比Oracle官方文档通俗易懂,无论是数据库开发、还是数据库管理,都可以读的一本经典权威作品
非常好看的登陆页面和主页面
用html写的非常好看的登录页面,主页面包括左侧导航,点击左侧导航显示右面内容。适合初学者。
tomcat6.0 32位操作系统
tomcat6.0 32位操作系统。 上传的时候没有删掉里面的项目跟图片,可已在webapp里面将项目给删除掉。
jsf +jdbc+spring实现的增设改查,分页,导入数据。导出数据、日志
用jsf+ jdbc+spring 写的增删改查,包括分页、导入数据、和导出数据
三大框架下分页源代码
三大框架分页的实现:
DAO里写法:
//查出页面要显示的字段 -----分页代码 页面上的查询全部
public List<TblNews> page(Integer pageno) {
// TODO Auto-generated method stub
log.debug("find TblNewsclass instance");
try {
String sql = "select new TblNews(id,title,pubdate,status) from TblNews";
Query query = getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery(sql);
query.setFirstResult(pageno);
query.setMaxResults(3); //设置每页显示的条数
List result = query.list();
log.debug("delete successful");
return result;
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public Integer getRows() {//查询出数据库里的条数
// TODO Auto-generated method stub
log.debug("find TblNewsclass instance");
try {
String sql = "select count(*) from TblNews";
Query query = getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery(sql);
List list = query.list();
log.debug("delete successful");
return ((Long)list.get(0)).intValue();
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
Action里的代码实现:
private Integer totalElements;//总记录数
private Integer pageNow=1;//当前页
private Integer pageSize=3;//当前页面的记录数
private Integer pageCount;//总页数
private Integer no;
上面就个成员变量再给个set()get()方法;
//查询全部
public String findAll()throws Exception{
List<TblNews> list = newsService.page(getRowsno()); //参数是算出的页面的总条数
if(list.size()!=0){
ActionContext.getContext().put("news",list);
return "findAllSuccess";
}else{
return ERROR;
}
}
//分页算法
public Integer getRowsno(){
Integer totalElements = newsService.getRows();
pageCount = (totalElements + pageSize - 1) / pageSize;//计算出总页数
if(pageNow <1){
pageNow = 1;
}
if(pageNow > pageCount){
pageNow = pageCount;
}
no = (pageNow -1)*pageSize;//实际的记录开始数
return no;
}
Jsp页面写法:
<div id="page">
<s:property value="pageNow"/>/<s:property value="pageCount"/>页
<s:url id="url_pre" value="news_findAll.action">
<s:param name="pageNow" value="pageNow-1"></s:param>
</s:url>
<s:url id="url_next" value="news_findAll.action">
<s:param name="pageNow" value="pageNow+1"></s:param>
</s:url>
<s:url id="url_first" value="news_findAll.action">
<s:param name="pageNow" value="1"></s:param>
</s:url>
<s:url id="url_last" value="news_findAll.action">
<s:param name="pageNow" value="pageCount"></s:param>
</s:url>
<s:a href="%{url_first}">首页</s:a>
<s:if test="pageNow>1">
<s:a href="%{url_pre}">上一页</s:a>
</s:if>
<s:else>
上一页
</s:else>
<s:if test="pageNow!=pageCount">
<s:a href="%{url_next}">下一页</s:a>
</s:if>
<s:else>
下一页
</s:else>
<s:a href="%{url_last}">尾页</s:a>
</div>
配置文件里写
<beans xmlns="http://www.springframework.org/schema/beans"
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.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<!-- 新闻类型 -->
<bean id="newsclassDAO" class="com.cstp.dao.impl.TblNewsclassDAO">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
<!-- 新闻类型 -->
<bean id="newsclassService" class="com.cstp.service.impl.TblNewsclassService">
<property name="classdao">
<ref bean="newsclassDAO"/>
</property>
</bean>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="attachDirty*" propagation="REQUIRED"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice> //tx标签代表时间传播
<aop:config>//切入
<aop:pointcut id="allServiceMethod" expression="execution(* com.cstp.service.*.*(..))"/>
<aop:advisor pointcut-ref="allServiceMethod" advice-ref="txAdvice"/>
</aop:config>
<!-- 新闻类型 -->
<bean id="newsclassAction" class="com.cstp.web.NewsclassAction">
<property name="newsclassService"> //这个名字要和action里定义的那个成员变量对应
<ref bean="newsclassService"/>
</property>
</bean>