Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 包含带有自定义标记的jspf文件_Java_Jsp_Custom Tags_Jsp Fragments - Fatal编程技术网

Java 包含带有自定义标记的jspf文件

Java 包含带有自定义标记的jspf文件,java,jsp,custom-tags,jsp-fragments,Java,Jsp,Custom Tags,Jsp Fragments,如何通过自定义标记将jspf文件添加到jsp页面 在标记支持类中,我可以使用….添加jspf的代码 JspWriter writter = this.pageContext.getOut(); writter.append( "html code"); 但我该怎么添加文件呢?如果jspf文件指的是在静态include中引用的JSP片段,例如,您不能 原因是静态包含是在JSP编译之前处理的,而标记库是在JSP编译之后处理的 相反,如果您指的是通常通过调用的动态include,那么您可以通过请求调

如何通过自定义标记将jspf文件添加到jsp页面

在标记支持类中,我可以使用….添加jspf的代码

JspWriter writter = this.pageContext.getOut();
writter.append( "html code");

但我该怎么添加文件呢?

如果jspf文件指的是在静态include中引用的JSP片段,例如,您不能

原因是静态包含是在JSP编译之前处理的,而标记库是在JSP编译之后处理的

相反,如果您指的是通常通过调用的动态include,那么您可以通过请求调度器从标记处理程序执行此操作

您可以始终将静态include包装在实现某些条件逻辑的标记处理程序中。这将控制是否将该片段的输出插入呈现页面。然而,它仍然会被编译到页面中,我怀疑您的目标是减少JSP的总体大小,在这种情况下,您就不走运了