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

  • 相关阅读:
    JAVA课程课后作业之使用递归完成回文
    原码、补码,反码以及JAVA中数值采用哪种码表示
    JAVA课后作业01
    java开学考试有感以及源码
    自动生成30道小学四则运算题目
    统计文档中单词出现频率
    JAVA课程课后作业03之动手动脑
    暑假假期周进度报告(第八周)
    字节流FileInputStream FileOutputStream四种读写,包装流BufferedOutputStream BufferedInputSream 缓冲区默认8192字节
    多态性
  • 原文地址:https://www.cnblogs.com/PoeticalJustice/p/7828421.html
Copyright © 2011-2022 走看看