使用struts2找不到jsp
尝试将hibernate集成到struts2框架中。 我看不出我做错了什么。Jetty找不到jsp的 严重:未找到PWC6117:File/Users/juliusskye/flightpub/src/main/webapp/pages/login.jsp struts文件使用struts2找不到jsp,jsp,struts2,jetty,filenotfoundexception,Jsp,Struts2,Jetty,Filenotfoundexception,尝试将hibernate集成到struts2框架中。 我看不出我做错了什么。Jetty找不到jsp的 严重:未找到PWC6117:File/Users/juliusskye/flightpub/src/main/webapp/pages/login.jsp struts文件 <struts> <!-- Configuration for the default package. --> <constant name="struts.enable.DynamicMe
<struts>
<!-- Configuration for the default package. -->
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<package name="Pages" namespace="/pages" extends="struts-default">
<action name="login"
method ="authenticate"
class="FPG2.view.LoginAction">
<result name="success">/pages/welcome.jsp</result>
<result name="error">/pages/login.jsp</result>
</action>
<action name="results"
method ="execute"
class="FPG2.view.ResultsAction">
<result name="success">/pages/error.jsp</result>
<result name="error">/pages/results.jsp</result>
</action>
</package>
</struts>
login.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title>FlightPub - Login Page</title>
</head>
<body>
<h2>Struts 2 - Login Application</h2>
<s:actionerror />
<s:form action="login.action" method="post">
<s:textfield name="username" key="label.username" size="20" />
<s:password name="password" key="label.password" size="20" />
<s:submit method="authenticate" key="label.login" align="center" />
</s:form>
</body>
</html>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>FlightPub</display-name>
<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>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
您在struts.xml中定义了错误的路径,您忘记了WEB-INF文件夹这可能是classloader的问题,您用Tomcat测试过吗?
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>FlightPub</display-name>
<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>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>