2011-07-17 6 views
0

私はstruts2に新しく、非常に素晴らしいstruts2フレームワークを習得しようとしています。Java Struts2アクションマップの問題

でも述べたように、私は非常に重要な問題にstucked午前: There is no Action mapped for namespace/and action name Struts2Example1.

私はIntelliJのIDEを使用していますし、私の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" 
     xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
     id="WebApp_ID" 
     version="2.5"> 

    <display-name>Struts2Example2</display-name> 

    <filter> 
     <filter-name>struts2</filter-name> 
     <!--<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>--> 
     <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> 

    <welcome-file-list> 
     <welcome-file>index.jsp</welcome-file> 
    </welcome-file-list> 
</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> 
</struts> 

誰でも助けることができますm eこのエラーを取り除く。

おかげ

+3

まあ、 。あなたが到達しようとしている名前空間に対してマップされたアクションはありません。あなたは、正確に何をしようとしているかについてより多くの情報を提供したいかもしれません。 – doctrey

+0

チュートリアルを読むhttp://struts.apache.org/2.x/docs/tutorials.html – leonbloy

+1

エラーメッセージは良い兆候です。これは、struts2があなたの要求を処理しようとしていることを意味します。だからあなたのweb.xmlは良いです。行方不明のものは、Struts2に "Struts2Example1"アクションが何であるかを伝えるものです。 struts.xmlやstruts2-conventions-pluginを使うことができます。これは、xmlで始める方が良いが、後で使う方がはるかに簡単です。 – Quaternion

答えて

2

新しいフレームワークを学ぶための最善の方法は、あなたが持っているもの、彼らが設定されているどのようにそれらをチェックして、彼らは Download Example Applications:

を実行しているかと、Struts2の公式サイトからいくつかのサンプル・アプリケーションをダウンロードすることですあなたの設定ファイルにいくつかのマッピングの問題があるようです あなたが提供したstruts.xmlファイルよりも多くのマッピングエントリが含まれていないので、常に完全な詳細を提供するのが良いです