2017-06-13 3 views
0

J'ai mis mon code struts2 helloWorld. Lorsqu'il est exécuté sur le serveur weblogic 10.3.6, cliquez sur la page index.jsp, il affiche l'erreur 404. Il devrait traiter l'action Bonjour mais pas. Y at-il manquant dans mon code. S'il vous plaît aider.struts2 helloWorld -> Afficher l'erreur 404

aeon_awip_application

+ --- src

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

Vous avez eu un mauvais tutoriel, déposez-le et commencez un nouveau ou mieux suivez les exemples de projets struts. –

Répondre

0

Je l'ai résolu en raison de problèmes de pots. Je n'ai pas utilisé le maven et utilisé le dossier lib dans lequel j'ai copié les pots en fonction du tuto