[英]Taglib inheritance in jsp:include
Is it possible to inherit taglibs or imports from parent JSPs in their "descendants"? 是否可以从父JSP的“后代”继承taglib或导入?
Let me show you an example 我举个例子
header.jsp
<%@ page contentType="text/html" isELIgnored="false"
import="org.something.utils.Constants"%>
//some code, Constants class is available here
index.jsp
<jsp:include page="template/header.jsp" />
//Constants is not available, I get a JasperException: Unable to compile class for JSP
also the taglibs inheritance doesn't seem to work. 同样,taglibs继承似乎不起作用。 So is there a way how to make this work? 那么有没有办法使这项工作呢?
Taglibs and imports are not inherited, and everything in a tag as well cannot be inherited or passed through pages (except for JspContext and request attributes). Taglib和导入不会被继承,并且标记中的所有内容也不能被继承或通过页面传递(JspContext和request属性除外)。
You have two options here: 您在这里有两个选择:
Edit Defining JSP implicit includes: 编辑定义JSP隐式包括:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.