gpt4 book ai didi

java - org.apache.tiles.definition.NoSuchDefinitionException

转载 作者:行者123 更新时间:2023-12-02 12:15:45 25 4
gpt4 key购买 nike

我尝试将图 block 添加到该项目中。但它一次又一次地给出同样的错误。错误是“org.apache.tiles.definition.NoSuchDefinitionException:/登录成功”

这是我的文件夹结构。

这是我的 struts.xml

    <?xml version="1.0" encoding="UTF-8" ?>  
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
"http://struts.apache.org/dtds/struts-2.1.dtd">

<struts>
<package name="tile_Framework" extends="tiles-default" >
<action name="login" class="tile_Framework.Login" method="execute">
<result name="success" type="tiles">/login-success</result>
<result name="error" type="tiles">/login-error</result>
</action>
</package>
</struts>

这是我的tiles.xml

    <?xml version="1.0" encoding="UTF-8" ?>   

<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">

<tiles-definitions>
<definition name="login-success" template="/layoutmanager.jsp">
<put-attribute name="title" value="Welcome Page"/>
<put-attribute name="body" value="/login-success.jsp"/>
</definition>

<definition name="login-error" template="/layoutmanager.jsp">
<put-attribute name="title" value="Login Error"/>
<put-attribute name="body" value="/login-error.jsp"/>
</definition>
</tiles-definitions>

这是 web.xml

    <?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>

<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>

这是我的layoutmanager.jsp

    <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><tiles:getAsString name="title" /></title>
</head>
<body>

<%@ include file="header.jsp" %>
<tiles:insertAttribute name="body" />
<%@ include file="footer.jsp" %>

</body>
</html>

我怎样才能摆脱这个错误。

最佳答案

尝试更改:

<result name="success" type="tiles">/login-success</result> 

至:

<result name="success" type="tiles">login-success</result> 

关于java - org.apache.tiles.definition.NoSuchDefinitionException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46190378/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com