组长让我做一个标签管理界面,试试手,但是一点也看不懂代码,拷贝也不知道什么意思,所以零开始一点一点理解开发,通过这种方式表示我所理解的发开。
1、首先从jsp页面开始:jsp是由指令元素+脚本元素+html模板组成的
在jsp页面的最上面出现:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
注解:
<@% %>这种是jsp指令
<% %>这种是jsp脚本,即在里面写java代码
<%@ page language="java" 是page指令2、接着就是下面这段代码:
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%>
注解:
request.getSchema()可以返回当前页面使用的协议,就是上面例子中的“http”
request.getServerName()可以返回当前页面所在的服务器的名字,就是上面例子中的“localhost"
request.getServerPort()可以返回当前页面所在的服务器使用的端口,就是8080,
request.getContextPath()可以返回当前页面所在的应用的名字,就是上面例子中的myblog(项目名称)
(1)<head></head>标签用于定义文档的头部,它是所有头部元素的容器,包括
元素可以引用脚本、指示浏览器在哪里找到样式表、提供元信息等,在这里也可以写jsp 的样式,但是需要用<style></style>
这是我们前段的写的,例如
<style>
.hr{
height: 40px;
}
.container{
height:980px
}
</style>
(2)<boby></boby>表格、表单、展示的内容等
首先在boby里面一个div 我理解的是这个class样式就是引用上面<styl></styl>里的container,也就是这个jsp页面的高;
action 是向controller发出获取的数据;
method 是提交过去的方式;
name 是提交给后果数据是用的名称;
id 是表单前调用时用的名称
<boby>
<div class="container">
<tboby>
<c:choose>
<c:when test="${not empty tagList}">
<div class="card-group" id="card-group">
<c:forEach items="${tagList}" var="PRINTSETUP" varStatus="vs">
//这里的tagTist是在contrller层
//List<PageData> tagList = tagService.taglistPage(page);
//mv.addObject("tagList", tagList);
<input type="hidden" value="" name="allchbox" id="allchbox">
<c:if test="${PRINTSETUP.ASSETNAME=='1'}"><div class="items"><span class="items1">资产名称:
</span><div class="items2">xxxxxxx</div></div>
</c:if>
</c:forEach>
</div>
</c:when>
</c:choose>
</tboby>
</from>