2017-06-13 103 views
0

我已经把我的struts2 helloWorld代码。当在weblogic服务器10.3.6上运行时,点击index.jsp页面,它会显示404错误。 它应该处理hello动作,但不处理。 我的代码中是否有任何缺失。请帮忙。struts2 helloWorld - >显示404错误

aeon_awip_application

+ --- SRC

+ --- --- SRC com.tutorialspoint.strut2(包)--- HelloWorldAction.java

+ --- SRC- --struts.xml

+ ---的WebContent

+ --- ---的WebContent index.jsp的

+ --- ---的WebContent WEB-INF --- web.xml中,weblogic.xml中

+ --- ---的WebContent WEB-INF --- ---的helloWorld的helloWorld.jsp

的index.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" 
    pageEncoding="ISO-8859-1"%> 
<%@ taglib prefix="s" uri="/struts-tags"%> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
<title>Hello World</title> 
</head> 
<body> 
    <h1>Hello World From Struts2</h1> 
    <form action="hello"> 
     <label for="name">Please enter your name</label><br/> 
     <input type="text" name="name"/> 
     <input type="submit" value="Say Hello"/> 
    </form> 
</body> 

的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" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" metadata-complete="true" version="2.5"> 
    <display-name>aeon_awip_application</display-name> 
    <welcome-file-list> 
    <welcome-file>index.html</welcome-file> 
    <welcome-file>index.htm</welcome-file> 
    <welcome-file>index.jsp</welcome-file> 
    <welcome-file>default.html</welcome-file> 
    <welcome-file>default.htm</welcome-file> 
    <welcome-file>default.jsp</welcome-file> 
    </welcome-file-list> 
    <listener> 
    <listener-class>org.springframework.web.context.ContextLoaderListener</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> 
</web-app> 

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="helloworld" namespace="/" extends="struts-default"> 
     <action name="hello" 
      class="com.tutorialspoint.struts2.HelloWorldAction" 
      method="execute"> 
      <result name="success">helloWorld/HelloWorld.jsp</result> 
     </action> 
    </package> 
</struts> 
+0

你错了教程,放下它,并开始一个新的或更好地遵循struts项目的例子。 –

回答

0

由于jar问题,我解决了它。我没有使用maven,并使用lib文件夹复制罐子根据tuto