<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<!-- 页内 全局起始路径 -->
<base href="${basePath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SpringMVC添加用户</title>
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet"
href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
<!-- 可选的 Bootstrap 主题文件(一般不用引入) -->
<link rel="stylesheet"
href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"
integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp"
crossorigin="anonymous">
<!-- Jquery 依赖 -->
<script src="https://cdn.bootcss.com/jquery/1.9.1/jquery.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script
src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<!-- 表单校验插件 -->
<script
src="https://cdn.bootcss.com/jquery.bootstrapvalidator/0.5.3/js/bootstrapValidator.min.js"></script>
<script type="text/javascript">
$(function() {
$('form')
.bootstrapValidator(
{
message : 'This value is not valid',
feedbackIcons : {
valid : 'glyphiconglyphicon-ok',
invalid : 'glyphiconglyphicon-remove',
validating : 'glyphiconglyphicon-refresh'
},
fields : {
userid : {
message : '用户id验证失败',
validators : {
notEmpty : {
message : '用户id不能为空'
},
regexp : {
regexp : /^[0-9]+$/,
message : '用户id只能包含数字'
}
}
},
userpwd : {
message : '密码无效',
validators : {
notEmpty : {
message : '密码不能为空'
},
stringLength : {
min : 6,
max : 20,
message : '密码长度必须在6到20之间'
},
regexp : {
regexp : /^[a-zA-Z0-9_\.]+$/,
message : ' 密码只能由字母,数字和下划线组成'
}
}
}
}
});
});
</script>
</head>
<body>
<ul class="nav nav-tabs" >
<c:if test="${(user.userlevel) eq '管理员'}">
<li class="dropdown">
<a href="#" data-toggle="dropdown">用户管理<span class="caret"></span></a>
<ul class="dropdown-menu">
<li> <a href="/admin/user/${user.userid}">查看全部用户</a></li>
<li><a href="/admin/user/${user.userid}/add">用户添加</a></li>
<li> <a href="/admin/user/${user.userid}/search">用户查询</a></li>
</ul>
</li>
</c:if>
<li class="dropdown">
<a href="#" data-toggle="dropdown">专业管理<span class="caret"></span></a>
<ul class="dropdown-menu">
<li> <a href="/admin/specialties/${user.userid}">查看全部专业</a></li>
<c:if test="${(user.userlevel) eq '管理员'}">
<li> <a href="/admin/specialties/${user.userid}/add">专业添加</a></li>
</c:if>
<li> <a href="/admin/specialties/${user.userid}/search">专业查询</a></li>
</ul>
</li>
<c:if test="${(user.userlevel) eq '管理员'}">
<li class="dropdown">
<a href="#" data-toggle="dropdown">班级管理<span class="caret"></span></a>
<ul class="dropdown-menu">
<li> <a href="/admin/classes/${user.userid}">查看全部班级</a></li>
<li> <a href="/admin/classes/${user.userid}/add">班级添加</a></li>
<li> <a href="/admin/classes/${user.userid}/search">班级查询</a></li>
</ul>
</li>
</c:if>
<c:if test="${(user.userlevel) eq '管理员'}">
<li class="dropdown">
<a href="#" data-toggle="dropdown">教师管理<span class="caret"></span></a>
<ul class="dropdown-menu">
<li> <a href="/admin/teachers/${user.userid}">查看全部教师</a></li>
<li> <a href="/admin/teachers/${user.userid}/add">教师添加</a></li>
<li> <a href="/admin/teachers/${user.userid}/search">教师查询</a></li>
</ul>
</li>
</c:if>
<c:if test="${(user.userlevel) eq '管理员'}">
<li class="dropdown">
<a href="#" data-toggle="dropdown">学生管理<span class="caret"></span></a>
<ul class="dropdown-menu">
<li> <a href="/admin/students/${user.userid}">查看全部学生</a></li>
<li> <a href="/admin/students/${user.userid}/add">学生添加</a></li>
<li> <a href="/admin/students/${user.userid}/search">学生查询</a></li>
</ul>
</li>
</c:if>
<li class="dropdown">
<a href="#" data-toggle="dropdown">课程管理<span class="caret"></span></a>
<ul class="dropdown-menu">
<li> <a href="/admin/courses/${user.userid}">查看全部课程</a></li>
<li> <a href="/admin/courses/${user.userid}/add">课程添加</a></li>
<li> <a href="/admin/courses/${user.userid}/search">课程查询</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" data-toggle="dropdown">课程表管理<span class="caret"></span></a>
<ul class="dropdown-menu">
<li> <a href="/admin/schedules/${user.userid}">查看全部课程表</a></li>
<li> <a href="/admin/schedules/${user.userid}/add">课程表添加</a></li>
<li> <a href="/admin/schedules/${user.userid}/search">课程表查询</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" data-toggle="dropdown">成绩管理<span class="caret"></span></a>
<ul class="dropdown-menu">
<li> <a href="/admin/stugrade/${user.userid}">查看全部成绩</a></li>
<li> <a href="/admin/stugrade/${user.userid}/add">成绩添加</a></li>
<li> <a href="/admin/stugrade/${user.userid}/search">成绩查询</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" data-toggle="dropdown">个人管理<span class="caret"></span></a>
<ul class="dropdown-menu">
<li> <a href="/admin/user/show/${user.userid}">查看个人信息</a></li>
</ul>
</li>
</ul>
<form class="form-horizontal" style="padding: 30px 100px 10px;"
action="/user/${user.userid}/addP" method="post" commandName="user1" role="form">
<fieldset>
<legend>SpringMVC添加用户</legend>
</fieldset>
<div class="form-group">
<label for="userid">用户id:</label>
<input type="text" class="form-control" id="userid" name="userid" placeholder="请输入userid:"/>
</div>
<div class="form-group">
<label for="userpwd">用户密码:</label>
<input type="password" class="form-control" id="userpwd" name="userpwd" placeholder="请输入用户密码:"/>
</div>
<div class="form-group">
<label for="userlevel">用户权限:</label>
<select class="form-control" id="userlevel" name="userlevel">
<option value="管理员">管理员</option>
<option value="教师">教师</option>
<option value="学生">学生</option>
</select>
</div>
<div class="form-group">
<button type="submit" class="btn btn-sm btn-success">提交</button>
</div>
</form>
</body>
</html>
jsp中有form后导航栏就会变形成下面这样
正常是这样的
网上找了很久都没找到解决办法……莱求助