资源预览内容
第1页 / 共13页
第2页 / 共13页
第3页 / 共13页
第4页 / 共13页
第5页 / 共13页
第6页 / 共13页
第7页 / 共13页
第8页 / 共13页
第9页 / 共13页
第10页 / 共13页
亲,该文档总共13页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
Maven + struts+ spring版本号:maven 2 Struts 2.1.8.1 Spring 3.0.0.RELEASE接着上个文档配置 maven2 + struts2(见 http:/wenku.baidu.com/view/19b8aa41336c1eb91a375dcb.html?st=1)来将 spring 加进去。项目创建路径图Web.xml SSH_protoencodingFilterorg.springframework.web.filter.CharacterEncodingFilterencodingutf-8contextConfigLocationclasspath*:applicationContext-services.xmlorg.springframework.web.context.ContextLoaderListenerCharacterEncodingFilterorg.springframework.web.filter.CharacterEncodingFilterencodingUTF-8forceEncodingtruestruts-cleanuporg.apache.struts2.dispatcher.ActionContextCleanUpstruts2 org.apache.struts2.dispatcher.FilterDispatcherstruts2 /*applicationContext-services.xmlfront-context.xmlPom.xml4.0.0my.webcatwar1.0webmars Ryan开发测试993985246qq.com +8mars whjzuiai开发76513716qq.com +8 com.springsource.repository.bundles.release EBR Spring Release Repository http:/repository.springsource.com/maven/bundles/release com.springsource.repository.bundles.external EBR External Release Repository http:/repository.springsource.com/maven/bundles/external 3.0.0.RELEASE 1.6.42.1.8.1junitjunit3.8.1testjavax.servlet servlet-api 2.4 providedjavax.servletjsp-api2.0providedorg.slf4jslf4j-api$org.slf4j.versionorg.slf4jslf4j-log4j12$org.slf4j.versionorg.slf4jjul-to-slf4j$org.slf4j.versionorg.apache.strutsstruts2-core$org.strtus.versionorg.apache.strutsstruts2-tiles-plugin$org.strtus.versionorg.apache.strutsstruts2-spring-plugin$org.strtus.versionasm asm-commons 2.2.3asmasm2.2.3commons-iocommons-io20030203.000550org.springframeworkorg.springframework.core$spring.versionorg.springframeworkorg.springframework.web$spring.versionorg.springframeworkorg.springframework.transaction$spring.versionorg.springframeworkorg.springframework.orm$spring.versionorg.springframeworkorg.springframework.jdbc$spring.versionorg.springframeworkorg.springframework.web.servlet$spring.versionorg.springframeworkorg.springframework.context$spring.versionorg.springframeworkorg.springframework.aop$spring.versionorg.springframeworkorg.springframework.expression$spring.versionorg.springframeworkorg.springframework.test$spring.versionnet.sourceforge.cglibcom.springsource.net.sf.cglib2.1.3org.apache.tilestiles-jsp2.0.4javax.servletjstl1.1.0org.apache.maven.plugins maven-eclipse-plugintrue true 2.0org.codehaus.mojo tomcat-maven-pluginmaven-javadoc-pluginhttp:/gceclub.sun.com.cn/Java_Docs/jdk6/html/zh_CN/apitruemaven-site-pluginzh_CN UTF-8org.mortbay.jetty maven-jetty-plugin 6.1.6maven-compiler-plugin1.6 1.6 UTF-8org.codehaus.mojo surefire-report-maven-pluginmaven-javadoc-pluginhttp:/gceclub.sun.com.cn/Java_Docs/jdk6/html/zh_CN/apitrue UTF-8UTF-8 UTF-8Struts.xmlWEB-INF/login.jspWEB-INF/login.jspLogback.xml INFOACCEPTDENY%-4relative %thread %-5level %logger30 - %msg%nUserDaopackage com.web.www.dao.impl;import com.web.www.dao.IUserDao;/* Created by IntelliJ IDEA.* User: ryan* Date: 11-11-19* Time: 下午 10:51*/ public class UserDao implements IUserDaoOverridepublic boolean save() return false; /To change body of implemented methods use File | Settings | File Templates.Overridepublic boolean update() System.out.print(“-update-“);return false; /To change body of implemented methods use File | Settings | File Templates.Overridepublic boolean delete() return false; /To change body of implemented methods use File | Settings | File Templates.Overridepublic boolean get() return false; /To change body of implemented methods use File | Settings | File Templates. UserAction package com.web.www.view;import com.opensymphony.xwork2.ActionSupport; import com.web.www.dao.IUserDao; import com.web.www.dao.impl.UserDao; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;/* Created by IntelliJ IDEA.* User: ryan* Date: 11-11-19* Time: 下午 10:53*/ public class UserAction extends ActionSupportprivate IUserDao userDao;public String execute()/ ApplicationContext context = new ClassPathXmlApplicationContext( /“applicationContext-services.xml“); /UserDao userDao = (UserDao) context.getBean(“userDao“); /obj.printHello();userDao.update();return SUCCESS;public IUserDao getUserDao() return userDao;public void setUserDao(IUserDao userDao) this.userDao = userDao; 使用 jetty 插件运行项目运行结果后台打印 “-update-” 表示 spring 成功
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号