2016-09-25 6 views
0

私はPlayフレームワークで非常に新しいです。私は非常に簡単なルートを追加する予定です。しかし、それはアクションが見つかりませんと言い続ける。Play Framework 2.5.xでルートを追加する方法は?

インデックスに対してのみ機能します。見つからない

処置:

enter image description here

マイApplication.java:

public class Application extends Controller { 

    public Result index() { 
     return ok(index.render()); 
    } 

    public Result home() { 
     return ok(home.render()); 
    } 

} 

ルートの設定ファイル:

# Routes 
# This file defines all application routes (Higher priority routes first) 
# ~~~~ 


# Landing page 
GET  /        controllers.Application.index() 


GET   /home       controllers.Application.home() 


# Map the JS resource paths 
GET  /*file       controllers.Assets.versioned(path="/public", file: Asset) 

activator clean compileを試してみましたが、まだそれは動作しません。 。

+0

あなたはクリーンオールを試しましたか? –

+0

@DenisBarucicはい。やった。 –

+0

アプリケーションにモジュールがインストールされていますか?同じプロジェクト内に複数のルートファイルが存在する可能性はありますか?それが本当にconf/routesのファイルで、他のルートファイルではないか確認してください。 –

答えて

0

ここで私はそれを修正しました。

# Landing page 
GET  /        controllers.Application.index() 

#After entering username and password 
GET   /home         controllers.Application.home() 

routeコマンドの前にコメントを追加しました。それは奇妙な、非常に奇妙です。

+0

良い神....... –

+0

@ALEX_AME Playフレームワークにはある種のバグがあります。 Play Frameworkのドキュメンテーションにはこれが決して言及されていません。そして、演劇のドキュメンテーションの問題は、彼らが何を言いたいのか、それは非常に難しいということです。 –

+0

私がPlayで始まったとき、テンプレートは私を大きく助けました。その例の多くは実際の例です:http://www.lightbend.com/activator/templates –

関連する問題