2011-07-07 16 views
0

私はstruts 2を初めて使用しましたが、このエラーメッセージが表示され続けます。何が問題なのでしょうか? XMLファイル01で結果が定義されておらず、結果が成功していません

struts.xml

<?xml version="1.0" encoding="UTF-8" ?> 
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> 
<struts> 

    <constant name="struts.devMode" value="false" /> 
    <constant name="struts.enable.DynamicMethodInvocation" value="false" /> 
    <package name="tutiworks" extends="struts-default"> 
     <action name="index"> 
      <result>/index.jsp</result> 
     </action>  
     <action name="hello" class="com.jjpeople.action.HelloAction" method="execute"> 
       <result name="success">/welcome.jsp</result> 
     </action> 
    </package> 
</struts> 

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> 
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 
<title>Basic Struts 2 Application - Welcome</title> 
</head> 
    <body> 
     <h1>Welcome To Struts 2!</h1> 
     <p><a href="<s:url action='hello'/>">Hello World</a></p> 
    </body> 
</html> 

Actionクラス

package com.jjpeople.action; 

import com.jjpeople.model.Hello; 
import com.opensymphony.xwork2.ActionSupport; 

public class HelloAction extends ActionSupport 
{ 
    private static final long serialVersionUID = 1L; 
    private Hello hello; 

    public String execute() throws Exception 
    { 
     hello = new Hello(); 
     return SUCCESS; 
    } 
    public Hello getMessage() 
    { 
     return hello; 
    } 
    public void setMessage(Hello hello) 
    { 
     this.hello = hello; 
    } 
} 
+0

** [Config Browser Plugin](http://struts.apache.org/2.1.8.1/docs/config-browser-plugin.html)**を使用して** Struts2の**アクションマッピングを確認してください。 – lschin

答えて

0
<action name="hello" class="com.jjpeople.action.HelloAction" method="execute">     <result name="success">/welcome.jsp</result>   </action>  

結果名は "成功" である、しかし、あなたのActionクラスであなたは "SICCESS" variable.Soをreturnd SUCCESS変数の値を確認してください。

0

結果はstruts.xmlであり、Actionは等しくありません。定義されていない例外が返されました。

関連する問題