zoukankan      html  css  js  c++  java
  • JAVAWEB 一一 SpringMVC(注解)

    web.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" 
    	xmlns="http://java.sun.com/xml/ns/javaee" 
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    	http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
      <display-name></display-name>	
      <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>
        <servlet>
      	<servlet-name>springmvc</servlet-name>
      	<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
      	<load-on-startup>1</load-on-startup>
      </servlet>
      <servlet-mapping>
      	<servlet-name>springmvc</servlet-name>
      	<url-pattern>*.do</url-pattern>
      </servlet-mapping>
    </web-app>
    

      

    springmvc-servler.xml

    <?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:mvc="http://www.springframework.org/schema/mvc" 
        xmlns:task="http://www.springframework.org/schema/task"
        xsi:schemaLocation="
            http://www.springframework.org/schema/beans 
            http://www.springframework.org/schema/beans/spring-beans-4.2.xsd 
            http://www.springframework.org/schema/context 
            http://www.springframework.org/schema/context/spring-context-4.2.xsd 
            http://www.springframework.org/schema/mvc 
            http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd 
            http://www.springframework.org/schema/task 
            http://www.springframework.org/schema/task/spring-task-4.2.xsd">
     	<context:component-scan base-package="com.annotation.*"/>
        <!-- 视图解析器-->
        <!--  /WEB-INF/jsp/success.jsp -->
        <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
            <property name="prefix" value="/jsp/"/>
            <property name="suffix" value=".jsp"/>
        </bean>
    </beans>
    

      

    Controller

    service

    dao

  • 相关阅读:
    [JSOI2007][BZOJ1030] 文本生成器|AC自动机|动态规划
    [NOI2014][BZOJ3670] 动物园|KMP
    [HAOI2010][BZOJ2427] 软件安装|tarjan|树型dp
    [JSOI2008][BZOJ1017] 魔兽地图DotR|树型dp
    [JLOI2014][BZOJ3631] 松鼠的新家|树上倍增LCA|差分
    [SDOI2010][BZOJ1975] 魔法猪学院|A*|K短路
    [BZOJ1251] 序列终结者|Splay
    hdu 2141 Can you find it?
    hdu 3152 Obstacle Course
    hdu 2680 Choose the best route
  • 原文地址:https://www.cnblogs.com/PoeticalJustice/p/7828421.html
Copyright © 2011-2022 走看看