您的位置:首页 > Web前端 > BootStrap

SSM开发之bootstrap整合

2020-03-02 01:31 190 查看

一、下载bootstrap

1.进入bootstrap官网,地址为https://www.bootcss.com,如下图

2.选择bootstrap进行下载,我这里下载的是bootstrap3,如下图

二、bootstrap使用

1.解压压缩包,粘到项目中,如下图

2.在jsp中引用bootstrap的js和css

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%
String contextPath = request.getContextPath();
String basePath = contextPath + "/CONFIG-INF";
%>

<!-- js import -->
<script src="<%=basePath%>/bootstrap/js/bootstrap.min.js"></script>

<!-- css import -->
<link href="<%=basePath%>/bootstrap/css/bootstrap.min.css" rel="stylesheet">

三、页面测试

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="../CONFIG-INF/common.jsp"></jsp:include>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登录</title>
</head>
<body>

<div class="container" style="width:400px; position: relative; top: 15%;">

<div class="form-signin">
<h2 class="form-signin-heading" style="text-align: center;">试卷分析系统</h2>
<input type="text" id="username" class="form-control margincss" placeholder="用户名" required autofocus>
<input type="password" id="password" class="form-control margincss" placeholder="密码" required>
<div>
<input type="text" id="checkcode" class="form-control margincss" placeholder="验证码" style="display: inline; width: 50%;" required>
<div style="float: right;" class="margincss">
<img id="checkImg" alt="请稍等" style="width: 80px; height: 35px;">
</div>
</div>
<div class="checkbox">
<label>
<input type="checkbox" value="remember-me"> 记住我
</label>
<div style="float: right;">
<a>忘记密码</a>
</div>
</div>
<button class="btn btn-lg btn-primary btn-block" type="button">登录</button>
</div>

</div>
</body>
</html>

注:这里的common.jsp引用了bootstrap的css和js
运行后的页面如下图:

…后续可能会有补充

  • 点赞
  • 收藏
  • 分享
  • 文章举报
叫天文的菜鸡程序猿 发布了10 篇原创文章 · 获赞 0 · 访问量 1090 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: