<?XML version= "1.0" encoding= "UTF-8"?> <Beansxmlns= "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/conte Xt/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.springfra Mework.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/> <!--set the jar package for the class where the annotations are used - <Context:component-scanBase-package= "Com.haier.framework.tms"></Context:component-scan> <!--complete mapping of requests and annotations Pojo - <Beanclass= "Org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" /> <!--path resolution for the steering page. Prefix: prefix, suffix: suffix - <Beanclass= "Org.springframework.web.servlet.view.InternalResourceViewResolver"P:prefix= "/pages/" /></Beans>
/** * */ PackageCom.haier.framework.tms;Importjava.io.IOException;Importjava.util.List;Importjavax.servlet.http.HttpServletRequest;ImportJavax.servlet.http.HttpServletResponse;ImportOrg.springframework.orm.hibernate3.HibernateCallback;ImportOrg.springframework.stereotype.Controller;Importorg.springframework.web.bind.annotation.RequestMapping;ImportOrg.springframework.web.bind.annotation.RequestMethod;ImportOrg.springframework.web.servlet.ModelAndView;ImportCom.google.gson.Gson;Importcom.haier.framework.core.utils.CommonJdbcDaoUtils;ImportCom.haier.framework.core.utils.Page;ImportCom.haier.framework.tms.module.TMS_LEG;/** * @authorXH **/@Controller @requestmapping (value= "/tms/ui/*") Public classTmscontroller {/** * * * @return */@RequestMapping (Value= "Index.jhtml", method =requestmethod.get) PublicModelandview INITECHARTSLH (httpservletrequest request, httpservletresponse response) {Gson Gson=NewGson (); System.out.println ("Query =============="); 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); intStart = 0; intLimit = 10; Page Page=NewPage (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 refers to the parameters that must be included in the request URL address mapping (unless attribute Required=false)//@RequestParam can be abbreviated as: @RequestParam ("username")//requestmapping ("test/login.do")//request URL address mapping, similar to struts action-mapping//Public string Testlogin (@RequestParam (value= "username") string//username, String password, httpservletrequest request) return NewModelandview ("tms/index.jsp"); } @RequestMapping (Value= "Getgrid") Public voidGetgrid (HttpServletRequest request, httpservletresponse response)throwsIOException {Gson Gson=NewGson (); String JSON= ""; String Start= Request.getparameter ("Start"); String Limit= Request.getparameter ("Limit"); Page Page=NewPage (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