简体   繁体   English

JSP动态包含标签

[英]JSP include tag dynamically

I got many custom tags, which I will include in my page depending on a string. 我有很多自定义标签,这些标签将根据字符串包含在我的页面中。 I know I can make a choose/when list with each tag written out and switched by the given string, but it is not what I want. 我知道我可以做出一个选择/何时列表,其中每个标签都写出并由给定的字符串切换,但这不是我想要的。 Something like this: 像这样:

<control:${controlName} param=${param} />

You could use some preprocessor, like frameworks such as Apache Struts do. 您可以使用一些预处理器,例如Apache Struts这样的框架。 In that case you'd probably have to implement your own markup and handle cases like EL that should be evaluated by the JSP engine, ie ${controlName} would have to be changed in order to distinguish between your own markup and JSP/Java EL. 在那种情况下,您可能必须实现自己的标记并处理应由JSP引擎评估的EL之类的情况,即必须更改${controlName}才能区分您自己的标记与JSP / Java EL 。

One preprocessor that you could use would be Apache Velocity . 您可以使用的一种预处理程序是Apache Velocity

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM