菜鸟——使用bootstrap
方法一:
直接在页面中加入bootstrap的网址,不需要做其他任何改动
<%-- Created by IntelliJ IDEA. User: JC Date: 2017/2/24 Time: 14:58 To change this template use File | Settings | File Templates. --%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <html> <head> <title>登录</title> <link href="http://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet"> <script src="http://apps.bdimg.com/libs/jquery/2.0.0/jquery.min.js"></script> <script src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script> </head> <body> <button type="button" class="btn btn-primary">(首选项)Primary</button> </body> </html>
界面效果:
bootstrap官网:
方法二:推荐用这种,如果不能上网,上面那种就看不到效果,根本加载不了bootstrap的文件资源
1、项目目录
2、代码
<%-- Created by IntelliJ IDEA. User: JC Date: 2017/2/24 Time: 14:58 To change this template use File | Settings | File Templates. --%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <html> <head> <title>登录</title> <link href="static/css/bootstrap/bootstrap.min.css" rel="stylesheet"> <script src="static/js/jquery/jquery-1.9.1.min.js"></script> <script src="static/js/bootstrap/bootstrap.min.js"></script> </head> <body> </body> </html>