SpringMVC 2.5.6 noMapping
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
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/context
http://www.springframework.org/schema/context/spring-context-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
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<context:annotation-config /> <!-- 设置使用注解的类所在的jar包 -->
<context:component-scan base-package="com.haier.framework.tms"></context:component-scan> <!-- 完成请求和注解POJO的映射 -->
<bean
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" /> <!-- 对转向页面的路径解析。prefix:前缀, suffix:后缀 -->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/pages/" />
</beans>
/**
*
*/
package com.haier.framework.tms; import java.io.IOException;
import java.util.List; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView; import com.google.gson.Gson;
import com.haier.framework.core.utils.CommonJdbcDaoUtils;
import com.haier.framework.core.utils.Page;
import com.haier.framework.tms.module.TMS_LEG; /**
* @author XH
*
*/
@Controller
@RequestMapping(value = "/tms/ui/*")
public class TmsController { /**
*
*
* @return
*/
@RequestMapping(value = "index.jhtml", method = RequestMethod.GET)
public ModelAndView initEchartsLH(HttpServletRequest request, HttpServletResponse response) {
Gson gson = new Gson();
System.out.println("查询==============");
List<TMS_LEG> mm = CommonJdbcDaoUtils.query("select * from TMS_LEG where rownum<20", TMS_LEG.class);
System.out.println("query" + gson.toJson(mm)); System.out.println("get==============");
TMS_LEG leg = CommonJdbcDaoUtils.get("select * from TMS_LEG where rownum<20", TMS_LEG.class);
System.out.println("get==============" + gson.toJson(leg)); String sysdat = CommonJdbcDaoUtils.queryObject("select sysdate from dual", String.class);
System.out.println("QueryObject==============" + sysdat); request.setAttribute("sysdate", sysdat);
int start = 0;
int limit = 10;
Page page = new Page(start, limit, -1, limit, null);
CommonJdbcDaoUtils.findBySql(page, "select * from TMS_LEG where rownum<21",
"select count(1) from TMS_LEG where rownum<21", TMS_LEG.class);
System.out.println("page" + gson.toJson(page));
// return new ModelAndView(new RedirectView("../index.jsp"));
// return new ModelAndView("loginSuccess");
// @RequestParam是指请求url地址映射中必须含有的参数(除非属性required=false)
// @RequestParam可简写为:@RequestParam("username")
// RequestMapping("test/login.do") // 请求url地址映射,类似Struts的action-mapping
// public String testLogin(@RequestParam(value="username")String
// username, String password, HttpServletRequest request)
return new ModelAndView("tms/index.jsp");
} @RequestMapping(value = "getGrid")
public void getGrid(HttpServletRequest request, HttpServletResponse response) throws IOException {
Gson gson = new Gson();
String json = "";
String start = request.getParameter("start");
String limit = request.getParameter("limit");
Page page = new Page(Integer.parseInt(start), Integer.parseInt(limit), -1, Integer.parseInt(limit), null);
CommonJdbcDaoUtils.findBySql(page, "select * from TMS_LEG where rownum<21",
"select count(1) from TMS_LEG where rownum<21", TMS_LEG.class);
json = gson.toJson(page);
System.out.println("page" + json);
response.getWriter().write(json);
}
}
SpringMVC 2.5.6 noMapping的更多相关文章
- 【分享】标准springMVC+mybatis项目maven搭建最精简教程
文章由来:公司有个实习同学需要做毕业设计,不会搭建环境,我就代劳了,顺便分享给刚入门的小伙伴,我是自学的JAVA,所以我懂的.... (大图直接观看显示很模糊,请在图片上点击右键然后在新窗口打开看) ...
- Springmvc数据校验
步骤一:导入四个jar包 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=" ...
- 为什么做java的web开发我们会使用struts2,springMVC和spring这样的框架?
今年我一直在思考web开发里的前后端分离的问题,到了现在也颇有点心得了,随着这个问题的深入,再加以现在公司很多web项目的控制层的技术框架由struts2迁移到springMVC,我突然有了一个新的疑 ...
- 【SSM框架】Spring + Springmvc + Mybatis 基本框架搭建集成教程
本文将讲解SSM框架的基本搭建集成,并有一个简单demo案例 说明:1.本文暂未使用maven集成,jar包需要手动导入. 2.本文为基础教程,大神切勿见笑. 3.如果对您学习有帮助,欢迎各种转载,注 ...
- 快速搭建springmvc+spring data jpa工程
一.前言 这里简单讲述一下如何快速使用springmvc和spring data jpa搭建后台开发工程,并提供了一个简单的demo作为参考. 二.创建maven工程 http://www.cnblo ...
- redis集成到Springmvc中及使用实例
redis是现在主流的缓存工具了,因为使用简单.高效且对服务器要求较小,用于大数据量下的缓存 spring也提供了对redis的支持: org.springframework.data.redis.c ...
- 流程开发Activiti 与SpringMVC整合实例
流程(Activiti) 流程是完成一系列有序动作的概述.每一个节点动作的结果将对后面的具体操作步骤产生影响.信息化系统中流程的功能完全等同于纸上办公的层级审批,尤其在oa系统中各类电子流提现较为明显 ...
- springMVC学习笔记--知识点总结1
以下是学习springmvc框架时的笔记整理: 结果跳转方式 1.设置ModelAndView,根据view的名称,和视图渲染器跳转到指定的页面. 比如jsp的视图渲染器是如下配置的: <!-- ...
- springMVC初探--环境搭建和第一个HelloWorld简单项目
注:此篇为学习springMVC时,做的笔记整理. MVC框架要做哪些事情? a,将url映射到java类,或者java类的方法上 b,封装用户提交的数据 c,处理请求->调用相关的业务处理—& ...
随机推荐
- javascript中的后退和刷新
<input type=button value=刷新 onclick="window.location.reload()"><input type=button ...
- Android View.onMeasure方法的理解
View在屏幕上显示出来要先经过measure(计算)和layout(布局).1.什么时候调用onMeasure方法? 当控件的父元素正要放置该控件时调用.父元素会问子控件一个问题,“你想要用多大地方 ...
- android volley get请求使用
调用百度api微博热门精选接口,使用了volley,简单说说volley get的请求方式的使用 header的设置和请求参数的设置,见代码如下: private void getWeixinNews ...
- linux 高级编程之库的使用
一.静态库与动态库 静态库: .a .lib 动态库: .so .dll 差别(静态库中的代码在链接时就已经复制到可执行文件中,执行时不再依赖库,不会自动使用升级后的库,需要重新产生可执行文件. 动态 ...
- MySQL基础 - 内置函数
Concat() 用于连接字段,一般DBMS使用+或者||. ex: 注意:上图中新检索出来的列名为'CONCAT(id, '->', name)'(实际上没有列名),这样虽然不影响在MySQL ...
- ubuntu14.04上安装Mysql-5.7.11
先安装好操作系统 在Mysql官网上下载最新版的Ubuntu Linux专用的Mysql.我这里下载的是:mysql-server_5.7.11-1ubuntu14.04_amd64.deb-bu ...
- Linux第十一次学习笔记
异常控制流 异常控制流(ECF)发生在计算机系统的各个层次 在硬件层,硬件检测到的事件会触发控制突然转移到异常处理程序. 在操作系统层,内核通过上下文转换将控制从一个用户进程转移到另一个用户进程. 在 ...
- IOS开发之——登录加密也许用到的,反转字符串
- (NSString *)stringByReversed{// NSMutableString *s = [NSMutableString string];// for (NSUInt ...
- IOS开发之——Masonry 只支持OC,暂不支持swift
前言 1 MagicNumber -> autoresizingMask -> autolayout 以上是纯手写代码所经历的关于页面布局的三个时期 在iphone1-iphone3gs时 ...
- php上传图片---初级版
没有样式,没有淘宝的那种放大截取大小的效果,只是实现了图片上传的功能. 图片超过100k,会出现内部错误服务器错误,需要手动更改配置文件里的MaxRequestLen属性. 下面粘上代码: <? ...