我正在为我的项目使用 struts2+hibernate 集成,并在其中实现了磁贴,但遇到了这个问题
struts.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name="default" extends="hibernate-default">
<result-types>
<result-type name="tiles"
class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<action name="*Menu" method="{1}"
class="com.struts2hibernatepagination.action.MenuAction">
<result name="tiger" type="tiles">tiger</result>
<result name="lion" type="tiles">lion</result>
</action>
<action name="addStudent" method="execute"
class="com.struts2hibernatepagination.action.AddStudentAction">
<interceptor-ref name="defaultStackHibernateStrutsValidation">
<param name="validation.excludeMethods">listStudents</param>
<param name="validation.excludeMethods">fetchStudentList</param>
</interceptor-ref>
<result name="success" type="redirect">
listStudents
</result>
<result name="input">/student.jsp</result>
</action>
<action name="listStudents" method="listStudents"
class="com.struts2hibernatepagination.action.AddStudentAction">
<interceptor-ref name="basicStackHibernate" />
<result name="success">/student.jsp</result>
<result name="input">/student.jsp</result>
</action>
<action name="fetchStudentList"
class="com.struts2hibernatepagination.action.AddStudentAction"
method="listStudents">
<interceptor-ref name="basicStackHibernate" />
<result name="success">/displaytag.jsp</result>
<result name="input">/student.jsp</result>
</action>
<action name="listStudentByName"
class="com.struts2hibernatepagination.action.AddStudentAction"
method="edit">
<interceptor-ref name="basicStackHibernate" />
<result name="success">/searchStudent.jsp</result>
<result name="input">/searchStudent.jsp</result>
</action>
<action name="studentFirstNameList"
class="com.struts2hibernatepagination.action.AddStudentAction"
method="studentFirstName">
<interceptor-ref name="basicStackHibernate" />
<result name="success">/searchStudent.jsp</result>
</action>
</package>
</struts>
瓷砖.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_2.dtd">
<tiles-definitions>
<definition name="baseLayout" template="/baseLayout.jsp">
<put-attribute name="title" value="Template" />
<put-attribute name="banner" value="/banner.jsp" />
<put-attribute name="menu" value="/menu.jsp" />
<put-attribute name="body" value="/body.jsp" />
<put-attribute name="footer" value="/footer.jsp" />
</definition>
<definition name="tiger" extends="baseLayout">
<put-attribute name="title" value="Tiger" />
<put-attribute name="body" value="/tiger.jsp" />
</definition>
<definition name="lion" extends="baseLayout">
<put-attribute name="title" value="Lion" />
<put-attribute name="body" value="/lion.jsp" />
</definition>
</tiles-definitions>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>Struts2Example17</display-name>
<context-param>
<param-name>
org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
</param-name>
<param-value>
/WEB-INF/tiles.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.apache.struts2.tiles.StrutsTilesListener
</listener-class>
</listener>
<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>
<welcome-file-list>
<welcome-file>student.jsp</welcome-file>
</welcome-file-list>
</web-app>
MenuAction.java
package com.struts2hibernatepagination.action;
import com.opensymphony.xwork2.ActionSupport;
public class MenuAction extends ActionSupport {
public String tiger() {
return "tiger";
}
public String lion() {
return "lion";
}
}
横幅.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<img src="http://www.tutorialspoint.com/images/tp-logo.gif"/>
</body>
</html>
基本布局.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>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title><tiles:insertAttribute name="title" ignore="true" /></title>
</head>
<body>
<tiles:insertAttribute name="banner" />
<br />
<hr />
<tiles:insertAttribute name="menu" />
<br />
<hr />
<tiles:insertAttribute name="body" />
<br />
<hr />
<tiles:insertAttribute name="footer" />
<br />
</body>
</html>
狮子.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<img src="http://upload.wikimedia.org/wikipedia/commons/d/d2/Lion.jpg"/>
The lion
</body>
</html>
菜单.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<a href="<s:url action="tigerMenu"/>">Tiger</a>
<br>
<a href="<s:url action="lionMenu"/>">Lion</a>
<br>
</body>
</html>
老虎.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<img src="http://www.freewebs.com/tigerofdarts/tiger.jpg" /> The tiger
</body>
</html>
我在项目中使用的库列表
这是我尝试访问http://localhost:8080/Struts2HibernatePagination/tigerMenu.action 后的快照
有人可以告诉我为什么我得到这个异常,因为我从过去 2 天开始就被这个问题困扰着,并且尝试了很多改变各种库但没有任何效果!!..请帮助!:(