jsp页面中使用jstl表达式---html转换为jsp---jsp页面中配置统一根路径【项目记录】

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. 完后本页面所有的相对引用地址直接从配置的根路径下面开始:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值