JspTaglib ["http://tiles.apache.org/tags-tiles"]未定义:无法将其分配给图块 [英] JspTaglib ["http://tiles.apache.org/tags-tiles"] is undefined: It cannot be assigned to tiles

查看:65
本文介绍了JspTaglib ["http://tiles.apache.org/tags-tiles"]未定义:无法将其分配给图块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将更新转换为一个非常老的Java项目,并在Spring Boot下对其进行转换.但是,在使用Struts 2, .ftl 和Apache Tiles构建这些首页时,我很难呈现它们.

I'm doing an update conversion to a very old Java project and converting it under Spring Boot. But, I'm having difficulties getting the front pages to be render as they were built with Struts 2, .ftl using Apache Tiles.

由于某种原因,我收到此错误 JspTaglibs 未定义.尝试加载页面时,无法将其分配给图块.

For some reason I get this error JspTaglibs is undefined. It cannot be assigned to tiles, when it tries to load the page.

我检查了所有必要的 jar 文件(我认为吗?),但是由于我对 .ftl 或图块一点都不熟悉,我可以不能帮助自己找出问题所在.

I have checked that I had all the jar files necessary (I think?), but as I'm not at all familiar with .ftl or tiles I can't help myself to figure out what is the problem.

依赖项:

    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-core</artifactId>
        <version>2.2.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-api</artifactId>
        <version>2.2.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-jsp</artifactId>
        <version>2.2.2</version>
    </dependency>

    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-core</artifactId>
        <version>2.1.8.1</version>
    </dependency>

    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-tiles-plugin</artifactId>
        <version>2.1.8</version>
    </dependency>

    <dependency>
        <groupId>org.freemarker</groupId>
        <artifactId>freemarker</artifactId>
        <version>2.3.15</version>
    </dependency>

我正在将磁贴分配给这样的页面

I'm assigning the tiles to the page like this

<#assign tiles=JspTaglibs["http://tiles.apache.org/tags-tiles"]>

<@tiles.insertAttribute name="navigation" /> 

<@tiles.insertAttribute name="body" /> 

推荐答案

将其添加到您的 web.xml 或使用Spring Boot引导该servlet.

Add this to your web.xml or bootstrup this servlet with Spring Boot.

<servlet>
    <servlet-name>jspSupportServlet</servlet-name>
    <servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class>
    <load-on-startup>5</load-on-startup>
</servlet>


需要将Freemarker与Struts 2中的Tiles集成.


It's needed to integrate Freemarker with Tiles in Struts 2.

您可以使用 struts-examples 切片项目来演示这种集成.还要升级到最新的Struts版本.

You can use struts-examples tiles project that demonstrates such integration. Also upgrade to the latest Struts version.

您可以在 pom.xml 中找到该项目的明智部分.

The sensible part of this project you can find in pom.xml.

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <struts2.version>2.5.8</struts2.version>
</properties>

这篇关于JspTaglib ["http://tiles.apache.org/tags-tiles"]未定义:无法将其分配给图块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆