赞
踩
(2)创建JSP目录
(3)创建springmvc.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”
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<context:component-scan base-package=“com.itzheng.crm.controller” />
<mvc:annotation-driven />
(四)Web.xml文件
配置Spring
配置前端控制器
<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xmlns=“http://java.sun.com/xml/ns/javaee”
xsi:schemaLocation=“http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd”
id=“WebApp_ID” version=“2.5”>
boot-crm
index.html
index.htm
index.jsp
default.html
default.htm
default.jsp
contextConfigLocation
classpath:spring/applicationContext-*.xml
org.springframework.web.context.ContextLoaderListener
encoding
org.springframework.web.filter.CharacterEncodingFilter
encoding
/*
boot-crm
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:spring/springmvc.xml
1
boot-crm
*.action
下载JSP页面代码直接导入到项目当中:JSP页面下载地址:https://download.csdn.net/download/qq_44757034/16528744
1、创建控制器:CustomerController
package com.itzheng.crm.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/*
*/
@Controller
@RequestMapping(“customer”)
public class CustomerController {
@RequestMapping(“list”)
public String list() {
return “customer”;
}
}
2、创建customer.jsp
<%@ page language=“java” contentType=“text/html; charset=UTF-8”
pageEncoding=“UTF-8”%>
<%@ page trimDirectiveWhitespaces=“true”%>
<%@ taglib prefix=“c” uri=“http://java.sun.com/jsp/jstl/core”%>
<%@ taglib prefix=“itzheng” uri=“http://itzheng.cn/common/”%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + “
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。