如何在JSP中导入我的导入内容? [英] How to import my imports in JSP?
本文介绍了如何在JSP中导入我的导入内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我所有的JSP都在顶部:
All of my JSPs have this at the top:
<%@ page language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib tagdir="/WEB-INF/tags" prefix="tag" %>
除了重复之外,由于偶尔的不一致,我还遇到了一些难以发现的错误.例如,我的一些JSP文件丢失了,isELIgnored="false"
,造成了无法估量的破坏.
Besides being repetitive, I have had a few hard-to-find bugs because of occasional inconsistencies. For example, a few of my JSP files were missing, isELIgnored="false"
, causing untold havoc.
有什么方法可以将这些导入文件放入文件中,然后在每个JSP中导入该文件,而不是在每个文件中列出所有这些导入文件?
Is there any way to put these imports into a file and then import that file in each JSP, rather than listing all of these imports in each file?
推荐答案
是的,我总是使用include.jsp,例如:
Yes, I always use an include.jsp such as:
<%@ page session="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="form" uri="/spring-form" %>
<%@ taglib prefix="spring" uri="/spring" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
,然后使用import语句在页面中引用它:
and then reference that in the page using the import statement:
<%@ include file="/WEB-INF/jsp/include.jsp" %>
这篇关于如何在JSP中导入我的导入内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文