/**
* File Name:CityController.java
*
* Copyright Defonds Corporation 2015
* All Rights Reserved
*
*/
package com.defonds.bdp.city.controller;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.defonds.bdp.city.bean.City;
import com.defonds.bdp.city.service.CityService;
/**
*
* Project Name:bdp
* Type Name:CityController
* Type Description:
* Author:Defonds
* Create Date:2015-08-27
* @version
*
*/
@Controller
@RequestMapping("/city")
public class CityController {
private final Log logger = LogFactory.getLog(this.getClass());
@Autowired
private CityService cityService;
@RequestMapping("/welcome")
public ModelAndView helloWorld() {
String message = "<br><div style='text-align:center;'>"
+ "<h3>********** Hello World, Spring MVC Tutorial</h3>This message is coming from CityController.java **********</div><br><br>";
return new ModelAndView("welcome", "message", message);
}
/**
* provinceCities(这里用一句话描述这个方法的作用)
* TODO(这里描述这个方法适用条件 – 可选)
* TODO(这里描述这个方法的执行流程 – 可选)
* TODO(这里描述这个方法的使用方法 – 可选)
* TODO(这里描述这个方法的注意事项 – 可选)
* @param name
* @param @return 设定文件
* @return String DOM对象
* @Exception 异常对象
* @since CodingExample Ver(编码范例查看) 1.0.0
*/
@RequestMapping("/province/cities")
@ResponseBody
public Object provinceCities() {
List<City> list = new ArrayList<City>();
City city1 = new City();
city1.setId("126");
city1.setCity("济南市");
city1.setCityCode("4510");
city1.setCityJb("省级");
city1.setCityName("济南市");
city1.setProvince("山东省");
list.add(city1);
City city2 = new City();
city2.setId("127");
city2.setCity("济南市");
city2.setCityCode("4510");
city2.setCityJb("县级");
city2.setCityName("商河县");
city2.setProvince("山东省");
list.add(city2);
return list;
}
@RequestMapping("/create")
@ResponseBody
public Integer create() {
try {
this.cityService.insertCity();
return 1;
} catch (Exception e) {
logger.error(e);
}
return 0;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
本资源是一个最新 spring4 + mybatis3 集成的一个简单的 demo,也是博客《零基础整合 spring 4(包括mvc、context、orm) + mybatis 3 示例》的配套示例项目,该博客地址是:http://blog.csdn.net/defonds/article/details/48137969。
资源推荐
资源详情
资源评论
收起资源包目录
bdp.zip (68个子文件)
bdp
pom.xml 4KB
target
test-classes
bdp-1.0.0.war 4.74MB
maven-status
maven-compiler-plugin
compile
default-compile
inputFiles.lst 86B
createdFiles.lst 53B
testCompile
default-testCompile
inputFiles.lst 0B
bdp-1.0.0
META-INF
MANIFEST.MF 39B
WEB-INF
web.xml 1KB
classes
com
defonds
bdp
city
controller
CityController.class 945B
bdp-servlet.xml 907B
jsp
welcome.jsp 720B
lib
spring-web-4.2.0.RELEASE.jar 748KB
spring-webmvc-4.2.0.RELEASE.jar 845KB
aopalliance-1.0.jar 4KB
spring-core-4.2.0.RELEASE.jar 1MB
spring-context-4.2.0.RELEASE.jar 1.03MB
commons-logging-1.1.3.jar 61KB
spring-beans-4.2.0.RELEASE.jar 712KB
jstl-1.2.jar 405KB
spring-aop-4.2.0.RELEASE.jar 355KB
spring-expression-4.2.0.RELEASE.jar 256KB
index.jsp 495B
m2e-wtp
web-resources
META-INF
maven
bdp
bdp
pom.xml 4KB
pom.properties 185B
MANIFEST.MF 110B
classes
mybatis-config.xml 287B
jdbc.properties 105B
log4j.properties 356B
com
defonds
bdp
city
dao
domain
City.class 2KB
mapper
CityMapper.xml 613B
controller
CityController.class 2KB
bdpmvc-servlet.xml 2KB
bdp-applicationContext.xml 3KB
maven-archiver
pom.properties 96B
generated-sources
annotations
CITY_CODE_CN.sql 684B
WebContent
META-INF
MANIFEST.MF 39B
WEB-INF
web.xml 1KB
classes
mybatis-config.xml 287B
jdbc.properties 105B
log4j.properties 356B
com
defonds
bdp
city
bean
City.class 2KB
mapper
CityMapper.class 188B
controller
CityController.class 3KB
service
CityService.class 2KB
bdpmvc-servlet.xml 2KB
bdp-applicationContext.xml 3KB
jsp
welcome.jsp 275B
lib
index.jsp 518B
.settings
org.eclipse.m2e.core.prefs 90B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.wst.common.project.facet.core.xml 345B
org.eclipse.core.resources.prefs 386B
org.eclipse.wst.common.component 830B
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.validation.prefs 50B
.jsdtscope 503B
org.eclipse.jdt.core.prefs 430B
src
test
resources
java
main
resources
mybatis-config.xml 287B
jdbc.properties 105B
log4j.properties 356B
com
defonds
bdp
city
mapper
CityMapper.xml 613B
bdpmvc-servlet.xml 2KB
bdp-applicationContext.xml 3KB
java
com
defonds
bdp
city
bean
City.java 2KB
mapper
CityMapper.java 425B
controller
CityController.java 3KB
service
CityService.java 1KB
.project 1KB
.classpath 1KB
共 68 条
- 1
Defonds
- 粉丝: 7092
- 资源: 428
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 大数据,字典大数据,字典大数据,字典大数据,字典大数据,字典
- 无标题123111113332
- 使用Hyperledger Fabric进行caliper压测,测试吞吐量及时延
- python-pandas-2.0.3及其依赖包+sqlalchemy-2.0.30及其依赖包+pymysql-1.1.0
- 通过IPIM实现命令行开关机
- Cat.1 AT指令和专业术语汇总
- “吃什么”软件,EW,eat what?
- unity中流血插件Real Blood v1.11
- 基于SpringBoot研发框架,它在SpringBoot的基础上,提供了诸如ReadinessCheck,类隔离,日志等能力
- 2024数维杯要点和难点,具体案例
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
前往页