字段名称 | 字段类型 | 字段含义 |
UUID | BIGINT | 主键:部门编号 |
名称 | VARCHAR | 部门名称 |
远程 | VARCHAR | 部门电话 |
[mw_shl_code = AppleScript的,真<建立> <plugins> <plugin> <groupId> org.apache.maven.plugins </ groupId> <artifactId> maven-compiler-plugin </ artifactId> <version> 2.3.2 </ version> <configuration> <source> 1.7 < / source> <target> 1.7 </ target> </ configuration> </ plugin> <plugin> <groupId> org.apache.tomcat.maven </ groupId> <artifactId> tomcat7-maven-plugin </ artifactId> <configuration > <! - 指定端口 - > <port> 8080 </ port> <! - 请求路径 - > <path> / </ path> </ configuration> </ plugin> </ plugins> </ build> [/ mw_shl_code] |
[mw_shl_code = AppleScript的,真] <%@页语言= “Java”的的contentType = “text / html的;字符集= UTF-8” 的pageEncoding = “UTF-8” %> <!DOCTYPE HTML PUBLIC“ - // W3C // DTD HTML 4.01 Transitional // EN“”http://www.w3.org/TR/html4/loose.dtd“> <html> <head> <meta http-equiv =”Content-Type“content =”text / html; charset = UTF-8“> <title>测试页面</ head> < / head> <body> 开启神秘的Maven世界〜 </ body> </ html> [/ mw_shl_code] |
tomcat7:运行 |
[mw_shl_code = applescript,true] <dependencies> <dependency> <groupId> javax.servlet </ groupId> <artifactId> servlet-api </ artifactId> <version> 2.5 </ version> <scope> provided </ scope> < / dependency> <dependency> <groupId> org.hibernate </ groupId> <artifactId> hibernate-core </ artifactId> <version> 5.0.7.Final </ version> </ dependency> <dependency> <groupId> org。 springframework </ groupId> <artifactId> spring-core </ artifactId> <version> 4.2.4.RELEASE </ version> </ dependency> <dependency> <groupId> org.springframework </ groupId> <artifactId的>弹簧豆</ artifactId的> <版本> 4.2.4.RELEASE </版本> </依赖性> <依赖性> <的groupId> org.springframework </的groupId> <artifactId的>弹簧上下文</ artifactId的> < version> 4.2.4.RELEASE </ version> </ dependency> <dependency> <groupId> org.springframework </ groupId> <artifactId> spring-orm </ artifactId> <version> 4.2.4.RELEASE </ version> </ dependency> <dependency> <groupId> org.springframework </ groupId> <artifactId>spring-test </ artifactId> <version> 4.2.4.RELEASE </ version> </ dependency> <依赖性> <的groupId> org.springframework </的groupId> <artifactId的>弹簧上下文支持</ artifactId的> <版本> 4.2.4.RELEASE </版本> </依赖性> <依赖性> <的groupId> org.springframework </的groupId> <artifactId的>弹簧的AOP </ artifactId的> <版本> 4.2.4.RELEASE </版本> </依赖性> <依赖性> <的groupId> org.springframework </的groupId> <artifactId的>弹簧的web < / artifactId> <version> 4.2.4.RELEASE </ version> </ dependency> <dependency> <groupId> org.aspectj </ groupId> <artifactId> aspectjweaver </ artifactId> <version> 1.8.7 </ version> </ dependency> <dependency> <groupId> org.apache.struts </ groupId> <artifactId> struts2-core </ artifactId> <version> 2.3.24 </ version> < / dependency> <dependency> <groupId> org.apache.struts </ groupId> <artifactId> struts2-spring-plugin </ artifactId> <version> 2.3.24 </ version> </ dependency> <dependency> <groupId> mysql </ groupId> <artifactId> mysql-connector-java </ artifactId> <version> 5.1.6 </ version> </ dependency> <dependency> <groupId> jstl </ groupId> <artifactId> jstl </ artifactId> <version> 1.2 </ version> </ dependency> </ dependencies> [/ mw_shl_code] |
[mw_shl_code = applescript,true] <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </ listener-class> </ listener> <context-param> <param-name> contextConfigLocation </ param-name > <param-value> classpath *:applicationContext.xml </ param-value> </ context-param> <filter> <filter-name> openSessionInView </ filter-name> <filter-class> org.springframework.orm。 hibernate5.support.OpenSessionInViewFilter </ filter-class> </ filter> <filter-mapping> <filter-name> openSessionInView </ filter-name> <url-pattern> / * </ url-pattern> </ filter-mapping > <滤波器> <filter-name> struts2 </ filter-name> <filter-class> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter </ filter-class> </ filter> <filter-mapping> <filter-name> struts2 </ filter-name> <url-pattern> / * </ url-pattern> </ filter-mapping> [/ mw_shl_code] |
[mw_shl_code = applescript,true]包cn.itcast.mavenweb.domain; / ** *部门 * @作者管理员 * * / 公共类Dep { 私人长期uuid; 私人字符串名称; 私人长途电话; public long getUuid(){ return uuid; } public void setUuid(Long uuid){ this.uuid = uuid; } public String getName(){ return name; } public void setName(String name){ this.name = name; } public String getTele(){ return tele; } public void setTele(String tele){ this.tele = tele; } } [/ mw_shl_code] |
[mw_shl_code = applescript,true] <?xml version =“1.0”encoding =“utf-8”?> <!DOCTYPE hibernate-mapping PUBLIC“ - // Hibernate / Hibernate Mapping DTD 3.0 // EN” “http:// hibernate.sourceforge.net/hibernate-mapping-3.0.dtd“> <hibernate-mapping> <class name =”cn.itcast.mavenweb.domain.Dep“table =”dep“> <id name =”uuid“> < / id> <property name =“name”/> <property name =“tele”/> </ class> </ hibernate-mapping> [/ mw_shl_code] |
[AppleScript] 纯文本查看 复制代码 package cn.itcast.mavenweb.dao; |
[mw_shl_code = applescript,true]包cn.itcast.mavenweb.dao.impl; import java.util.List; import org.springframework.orm.hibernate5.support.HibernateDaoSupport; import cn.itcast.mavenweb.dao.DepDao; import cn.itcast.mavenweb.domain.Dep; / ** *部门数据访问类 * @author管理员 * * / public类DepDaoImpl扩展的HibernateDaoSupport实现DepDao { @覆盖 公共名单<德普>的GetList(){ 回报(名单<德普>)getHibernateTemplate()。找到(“从德普“); } } [/ mw_shl_code] |
[mw_shl_code = applescript,true]包cn.itcast.mavenweb.service; import java.util.List; import cn.itcast.mavenweb.domain.Dep; / ** *部门业务层接口 * @作者管理员 * * / public interface DepService { / ** *全部列表 * @return * / public List <Dep> getList(); } [/ mw_shl_code] |
[mw_shl_code = applescript,true]包cn.itcast.mavenweb.service.impl; import java.util.List; import cn.itcast.mavenweb.dao.DepDao; import cn.itcast.mavenweb.domain.Dep; import cn.itcast.mavenweb.service.DepService; / ** *部门业务逻辑类 * @作者管理员 * * / 公共类DepServiceImpl实现DepService { 私人DepDao depDao; public void setDepDao(DepDao depDao){ this.depDao = depDao; } / ** *全部列表 * / public List <Dep> getList(){ // TODO自动生成的方法存根 返回depDao.getList(); } } [/ mw_shl_code] |
[mw_shl_code = applescript,true]包cn.itcast.mavenweb.web.action; import java.util.List; import org.apache.struts2.ServletActionContext; import com.opensymphony.xwork2.ActionContext; import cn.itcast.mavenweb.domain.Dep; import cn.itcast.mavenweb.service.DepService; / ** *部门行动 * @作者管理员 * * / 公共类DepAction { 私人DepService depService; public void setDepService(DepService depService){ this.depService = depService; } public String list(){ List <Dep> list = depService.getList(); ServletActionContext.getRequest()。setAttribute(“list”,list); 返回“列表”; } } [/ mw_shl_code] |
[mw_shl_code = applescript,true] <bean id =“depDao”class =“cn.itcast.mavenweb.dao.impl.DepDaoImpl”> <property name =“sessionFactory”ref =“sessionFactory”> </ property> </ bean > <bean id =“depService”class =“cn.itcast.mavenweb.service.impl.DepServiceImpl”> <property name =“depDao”ref =“depDao”> </ property> </ bean> <bean id =“ depAction“class =”cn.itcast.mavenweb.web.action.DepAction“> <property name =”depService“ref =”depService“> </ property> </ bean> [/ mw_shl_code] |
[mw_shl_code = applescript,true] <action name =“dep_ *”class =“depAction”method =“{1}”> <result name =“list”> / index.jsp </ result> </ action> mw_shl_code] |
[mw_shl_code = applescript,true] <%@ page language =“java”contentType =“text / html; charset = UTF-8” pageEncoding =“UTF-8”%> <%@ taglib prefix =“c”uri =“ http://java.sun.com/jsp/jstl/core“%> <!DOCTYPE html PUBLIC” - // W3C // DTD HTML 4.01 Transitional // EN“”http://www.w3.org/TR /html4/loose.dtd“> <html> <head> <meta http-equiv =”Content-Type“content =”text / html; charset = UTF-8“> <title>测试页面</ title> </头> <BODY> 开启神秘的Maven的世界〜结果 <C:VAR的forEach = “i”的项= “$ {列表}”> $ {i.uuid} $ {i.name} $ {i.tele} <br> </ c:forEach> </ body> </ html> [/ mw_shl_code] |
[mw_shl_code = AppleScript的,真<依赖性> <groupId> javax.servlet </ groupId> <artifactId> servlet-api </ artifactId> <version> 2.5 </ version> <scope> provided </ scope> </ dependency> <dependency> <groupId> org.hibernate < / groupId> <artifactId> hibernate-core </ artifactId> <version> $ {hibernate.version} </ version> </ dependency> <dependency> <groupId> org.springframework </ groupId> <artifactId> spring-core < / artifactId> <version> $ {spring.version} </ version> </ dependency> <dependency> <groupId> org.springframework </ groupId> <artifactId> spring-beans </ artifactId> <version> $ {spring.version} </ version> </ dependency> <dependency> <groupId> org.springframework </ groupId> <artifactId> spring-context </ artifactId> <version> $ {spring.version} < / version> </ dependency> <dependency> <groupId> org.springframework </ groupId> <artifactId> spring-orm </ artifactId> <version> $ {spring.version} </ version> </ dependency> <dependency> <groupId> org.springframework </ groupId> <artifactId> spring-test </ artifactId> <version>$ {spring.version} </ version> </ dependency> <dependency> <groupId> org.springframework </ groupId> <artifactId> spring-context-support </ artifactId> <version> $ {spring.version} </ version> </ dependency> <dependency> <groupId> org.springframework </ groupId> <artifactId> spring-aop </ artifactId> <version> $ {spring.version} </ version> </ dependency> <dependency> <groupId> org.springframework </ groupId> <artifactId> spring-web < artifactId> <version> $ {spring.version} </ version> </ dependency> <dependency> <groupId> org.aspectj </ groupId> <artifactId> aspectjweaver </ artifactId> <version> 1.8.7 </ version> </ dependency> <dependency> <groupId> org.apache.struts </ groupId> <artifactId> struts2-core </ artifactId> <version> $ {struts.version} </版本> </ dependency> <dependency> <groupId> org.apache.struts </ groupId> <artifactId> struts2-spring-plugin </ artifactId> <version> $ {struts.version} </ version> </ dependency> <dependency> <groupId> mysql </ groupId> <artifactId> mysql-connector-java </ artifactId> <version> 5.1.6 </ version> </ dependency> <dependency> <groupId> jstl </ groupId> <artifactId> jstl </ artifactId> <version> 1.2 </ version> </ dependency> [/ mw_shl_code] |
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |