jsp页面中使用jstl表达式 需要在文本头部先引入:
引入:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
使用:
<label>
<%-- 如果cookie中账户密码不为空,则勾选记住密码 添加checked属性--%>
<c:if test="${not empty cookie.loginAct and not empty cookie.loginPwd }">
<input type="checkbox" id="isRemPwd" checked>
</c:if>
<%-- 如果cookie中账户 或 密码为空,则不记住密码 --%>
<c:if test="${empty cookie.loginAct or empty cookie.loginPwd }">
<input type="checkbox" id="isRemPwd">
</c:if>
十天内免登录
</label>
html转换为jsp:
把这个声明替换成下面声明,然后把html后缀修改为jsp即可
<!DOCTYPE html>
替换----> <!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
jsp页面中配置统一根路径:
1. el表达式配置根路径:
<% String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/"; %>
2. 在head标签内添加:
<base href="<%=basePath%>">
3. 完后本页面所有的相对引用地址直接从配置的根路径下面开始: