Apache Tiles 路径根

发布于 2024-11-29 08:16:03 字数 768 浏览 3 评论 0原文

我正在使用 Tiles 2,我想要一个属性来设置资源的根路径。这是我的 XML:

<definition name="titledWrapper" template="/WEB-INF/templates/titledWrapper.jsp">
        <put-attribute name="includes" value="/WEB-INF/templates/includes.jsp" />
        <put-attribute name="navigation" value="/WEB-INF/templates/navigation.jsp" />
        <put-attribute name="body" value="" />
        <put-attribute name="pathRoot" value="./" type="string" />
</definition>

这是一个基本定义,我将从中扩展其他页面。在“titledWrapper.jsp”页面中,我有以下内容:

<img src="<tiles:getAsString name="pathRoot" />statics/images/corner.gif" />

我还导入了 Tiles 标记库。 getAsString 的其他用途也可以工作,尽管它们不在这样的属性中。当我加载页面时,我的图像源实际上是

I am using Tiles 2 and I want to have an attribute that sets the root path for resources. I have this is my XML:

<definition name="titledWrapper" template="/WEB-INF/templates/titledWrapper.jsp">
        <put-attribute name="includes" value="/WEB-INF/templates/includes.jsp" />
        <put-attribute name="navigation" value="/WEB-INF/templates/navigation.jsp" />
        <put-attribute name="body" value="" />
        <put-attribute name="pathRoot" value="./" type="string" />
</definition>

This is a base definition that I will extend other pages from. In the 'titledWrapper.jsp' page, I have this:

<img src="<tiles:getAsString name="pathRoot" />statics/images/corner.gif" />

I am also importing the Tiles tag lib. Other uses of getAsString work, though they are not in an attribute like this. When I load the page, my image source is literally <tiles:getAsString name=". What do I need to do differently to fix this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沙与沫 2024-12-06 08:16:03

我认为你应该使用“”而不是“”。

I think you should use ' ' instead of " ".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文