1、在web下新建一个view文件夹,讲index.jsp移入view中
2、web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>/</welcome-file>
</welcome-file-list>
</web-app>
3、spring.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:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:component-scan base-package="com.springs.mvc" />
<mvc:annotation-driven />
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/view/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
</beans>
4、com.spring.mvc.Controller:
package com.springs.mvc;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class Controller {
@RequestMapping("/")
public String pring(){
return "index11";
}
}
idea搭建springMVC
原创wx637630f8ac60c ©著作权
©著作权归作者所有:来自51CTO博客作者wx637630f8ac60c的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
springmvc 的原理以及工作流程(面试)
springMVC 工作流程及原理
MVC 工作流程 原理 -
IDEA搭建springMvc项目
IDEA搭建springmvc项目
springmvc IDEA spring tomcat 初始化 -
springMVC+maven+mybatis+Intellij IDEA环境搭建
之前工作中一直用springMVC和ibatis,现在要从0开始学习maven和mybatis,所以这篇博客就记录我
java 开发工具 数据库 spring mvc -
idea中搭建springmvc中web项目环境
1.先创建web项目2.选择自己的maven库3.这就是创建的web项目结构4.要再创建两个根目录来作为根目录,java和resources 一个
java http 网络 spring maven -
progressSQL
SQL语言和sqlplus常用的命令SQL概述结构化查询语言 (Structured Query Language),具有定义、查询、更新和控制等多种功能,是关系数据库的标准语言。注意: 大部分数据库都满足了sql标准,但是每个数据都会有自己的"方言"。比如说oralce 有序列, mysql有limitSQL分类:数据操纵语言DML Data Manipulation Language : SE
progressSQL SQL语言 java sqlplus常用命令 java 用户管理 java oracle数据库基本查找 -
flume采集hbase
一,Flume的描述1、Flume的概念Flume是分布式的日志收集系统,它将各个服务器中的数据收集起来并送到指定的地方去,比如说送到HDFS,Kafka,MySql;简单来说flume就是收集日志的。 2、Event的概念 Flume中event的相关概念:Flume的核心是把数据从数据源(source)收集过来,在将收集到的数据送到指定的目的地(sink)。为
flume采集hbase 分布式的采集文件系统 Flume的原理和架构 Flume的基本使用 数据