2017-06-13 5 views
0

Ich habe meinen struts2 halloWorld Code gesetzt. Wenn Sie auf dem Weblogic-Server 10.3.6 ausgeführt werden, klicken Sie auf die Seite index.jsp und es wird der Fehler 404 angezeigt. Es sollte die hallo Aktion aber nicht verarbeiten. Fehlt mein Code? Bitte helfen Sie.struts2 helloWorld -> show 404 Fehler

aeon_awip_application

src + ---

+ --- --- com.tutorialspoint.strut2 src (package) --- 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

kopiert habe Sie falsches Tutorial, lassen Sie es und starten Sie ein neues oder besser Struts Projektbeispiele folgen. –

Antwort

0

Ich habe es wegen Glasproblemen gelöst. Ich habe den Maven nicht verwendet und den lib-Ordner verwendet, in dem ich die Gläser nach dem Tuto