SpringMVC 2.5.6 noMapping

來源:互聯網
上載者:User

標籤:

<?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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.