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,处理请求->调用相关的业务处理—& ...
随机推荐
- 09Spring_AOP介绍和java本身的动态代理以及cglib代理
Aspect Oriented Programming 面向切面编程 1. 业界 AOP 实际上 OOP (面向对象编程 ) 延伸 ---- OOP编程语言. AOP设计思想,下面给出一张AOP的设 ...
- 26Spring_的注解实际应用_关键整理一下之前的注解
写一个银行转账案例, 案例结构如下:
- 携手K2 BPM,华住酒店完美实现“互联网+”转型
华住酒店集团,旗下6大品牌酒店,包括商旅品牌—禧玥酒店.全季酒店.星程酒店.汉庭酒店.海友酒店,以及度假品牌—漫心度假酒店.高端大气上档次一气呵成,2013年签约K2,携手成就美好生活. 演讲人:宋洪 ...
- [Elixir008]Nested Module里的动态函数调用方式
有时我们需要动态生成一些模块名,然后调用它里面的函数.但是我们常常碰到的却是明明有那个模块,结果还是raise模块未定义... 我们来看看到底怎么回事? 首先我们定义一个函数 iex(1)> d ...
- 存储过程中执行动态Sql语句
MSSQL为我们提供了两种动态执行SQL语句的命令,分别是EXEC和sp_executesql;通常,sp_executesql则更具有优势,它提供了输入输出接口,而EXEC没有.还有一个最大的好处就 ...
- tkinter 改变按钮状态
import tkinter as tk def btn1_change_btn1(event): '''方式一:通过事件控制自己''' if event.widget['state'] == 'no ...
- Chrome调试工具简单介绍
作为前端开发者都知道,快捷键F12可以打开chrome调试工具.firefox可以打开firebug工具.“工欲善其事,必先利其器”,对调试工具的掌握,能大大提高我们调试代码的效率.因为我平常chro ...
- 20155224聂小益 - 我的技能与C语言学习
20155224聂小益 - 我的技能与C语言学习 预备作业2 ● 你有什么技能比大多人(超过90%以上)更好? 我认为我可能有些技能身边有的人比较少有,但是要是超过90%以上我实在不敢保证.毕竟厉害的 ...
- android软键盘的一些控制 转来的,格式有点乱
"EditText + Button" 形成一个 "输入+按键响应" 的案例在android编程中是最常见不过的了. 但还有一些细节需要注意: 在EditTe ...
- 集DDD,TDD,SOLID,MVVM,DI,EF,Angularjs等于一身的.NET(C#)开源可扩展电商系统–Virto Commerce
今天一大早来看到园友分享的福利<分享一个前后端分离方案源码-前端angularjs+requirejs+dhtmlx 后端asp.net webapi>,我也来分享一个吧.以下内容由笔者写 ...