当前位置:首页 > S2S3H3(Struts2.3.4+Spring3.0+Hibernate3.3)配置步骤
在这一步,我们设置主键的生成方式为Native,其他的不用改变,点击Finish按钮 经过调整后的目录显示结构如下:
此时,applicationContext.xml文件中的代码如下:
package com.yangy.action; import java.util.List; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; import com.yangy.dao.EmpDAO; public class IndexAction extends ActionSupport { } public String execute(){ } ApplicationContext ac = new ClassPathXmlApplicationContext(\); EmpDAO ed = (EmpDAO) ac.getBean(\); List list = ed.findAll(); ActionContext.getContext().put(\, list); return SUCCESS; 3.0修改struts.xml配置文件
<%@ page language=\ import=\ pageEncoding=\%> <%@ taglib uri=\ prefix=\ %> <% String path = request.getContextPath(); String basePath = request.getScheme()+\+request.getServerName()+\+request.getServerPort()+path+\; %>