springMVC-笔记012-静态资源放行

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set value="${pageContext.request.contextPath}" var="path" scope="page" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>用户注册</title>
		<link rel="stylesheet" type="text/css" href="${path}/resources/css/bootstrap.min.css" />
	</head>

	<body>

		<form action="${path}/register" method="post" enctype="multipart/form-data">
			<table class="table">
				<tr>
					<td>用户名</td>
					<td><input type="text" name="customer_name" id="customer_name" /></td>
				</tr>
				<tr>
					<td>用户密码</td>
					<td><input type="password" name="customer_pwd" id="customer_pwd" /></td>
				</tr>
				<tr>
					<td>真实姓名</td>
					<td><input type="text" name="customer_rname" id="customer_rname" /></td>
				</tr>
				<tr>
					<td>性别</td>
					<td>
						<input type="radio" name="customer_gender" id="customer_gender1" value="m" checked="checked" />
						<label for="customer_gender1">男</label>
						<input type="radio" name="customer_gender" id="customer_gender2" value="w" />
						<label for="customer_gender2">女</label>
					</td>
				</tr>
				<tr>
					<td>联系电话</td>
					<td><input type="text" name="customer_phone" id="customer_phone" /></td>
				</tr>
				<tr>
					<td>用户头像</td>
					<td><input type="file" name="picfile" id="picfile" /></td>
				</tr>
				<tr>
					<td colspan="2">
						<input class="btn btn-danger" type="reset" name="reset" id="reset" value="重置" />
						<input class="btn btn-primary" type="submit" name="submit" id="submit" value="确定" />
					</td>
				</tr>
			</table>
		</form>

		<script src="${path}/resources/js/jquery-1.12.4.min.js"></script>
		<script src="${path}/resources/js/bootstrap.min.js"></script>

	</body>

</html>

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc.xsd">

	<!-- 组件扫描 -->
	<context:component-scan base-package="com.hm.controller">
		<!-- 扫描controller -->
		<context:include-filter type="annotation"
			expression="org.springframework.stereotype.Controller" />
	</context:component-scan>

	<!-- 启动mvc注解 -->
	<mvc:annotation-driven />

	<!-- 静态资源放行 -->
	<mvc:resources location="/resources/" mapping="/resources/**" />

	<!-- 文件上传 -->
	<bean id="multipartResolver"
		class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
		<!-- 文件最大5M -->
		<property name="maxUploadSize" value="5242880" />
		<!-- 默认编码UTF-8 -->
		<property name="defaultEncoding" value="UTF-8" />
		<!-- 延迟加载 -->
		<property name="resolveLazily" value="true" />
	</bean>

	<!-- 配置视图解析器 -->
	<bean id="jspViewResolver"
		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="viewClass"
			value="org.springframework.web.servlet.view.JstlView" />
		<property name="prefix" value="/WEB-INF/page/" />
		<property name="suffix" value=".jsp" />
	</bean>

</beans>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值