📄 vfonts.jsp
字号:
<%@ page pageEncoding="GB2312"%>
<%@ page contentType="text/html" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ include file="ispass.jsp" %>
<fmt:requestEncoding value="gb2312" />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>添加字体</title>
<link href="images/css.css" rel="stylesheet" type="text/css">
</head>
<body>
<c:set var="urls" value="<%=request.getHeader("Referer")%>" />
<c:catch var="isok">
<c:set var="isAdd" value="true" />
<%--检测相关参数是否正确--%>
<c:if test="${empty fn:trim(param.fontsName)}">
<c:set var="fontsNameError" scope="request" value="请填字体的中文名称" />
<c:set var="isAdd" value="false" />
</c:if>
<c:if test="${empty fn:trim(param.fontsurl)}">
<c:set var="fontsurlError" scope="request" value="请填写字体路径" />
<c:set var="isAdd" value="false" />
</c:if>
<%-- 检测是否有通过,否则重定向 --%>
<c:choose>
<c:when test="${isAdd}">
<sql:query var="isname">
Select * from fonts where fontsName = ?
<sql:param value="${fn:trim(param.fontsName)}"/>
</sql:query>
<c:if test="${isname.rowCount <= 0}">
<%-- 更新数据库 --%>
<sql:update>
insert into fonts (fontsName,fontsurl) values (?,?)
<sql:param value="${fn:trim(param.fontsName)}" />
<sql:param value="${fn:trim(param.fontsurl)}" />
</sql:update>
<%-- 定向到另一页面 --%>
<c:set var="errorMsg" scope="request" value="字体添加成功" />
<jsp:forward page="fonts.jsp" />
</c:if>
<c:if test="${isname.rowCount > 0}">
<c:set var="fontsNameError" scope="request" value="字体名已经存在" />
<jsp:forward page="fonts.jsp?tab=add" />
</c:if>
</c:when>
<c:otherwise>
<jsp:forward page="fonts.jsp?tab=add" />
</c:otherwise>
</c:choose>
</c:catch>
<c:if test="${!empty isok}">
<c:set var="errorMsg" scope="request" value="对不起参数提交错误,请返回另行操作!" />
<c:set var="errorUrl" scope="request" value="${urls}" />
<jsp:forward page="error.jsp" />
</c:if>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -