当前位置: 代码迷 >> 综合 >> Idea利用JSP模板设置统一路径(basePath)
  详细解决方案

Idea利用JSP模板设置统一路径(basePath)

热度:27   发布时间:2024-01-03 14:45:47.0

首先打开idea->settings界面,选择Editor/File and Code Templates,选择other界面

在这里插入图片描述
然后,我们设置模板页

<%--Created by IntelliJ IDEA.User: ${USER}Date: ${DATE}Time: ${TIME}To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/";
%>
<html><head><base href="<%=basePath%>"><title>#[[$Title$]]#</title></head><body>#[[$END$]]#</body>
</html>

参考链接:https://blog.csdn.net/gnail_oug/article/details/79667746

  相关解决方案