Spring MVC RequestMappingアノテーションで質問があります。君の力が必要。Spring @RequestMapping
私は1つのIPSLコントローラを作成しました。このコントローラには、url.iが2つのメソッドを作成したので、すべてのリクエストを処理するIPSLコントローラが必要です。
1)handleLogoutRequest:このメソッドは、urlの下で呼び出す必要があります。
2)handleRequest: - このメソッドは、すべてのリクエストurl以外のログアウトに対して呼び出す必要があります。 http://localhost:9086/webapp/remove
http://localhost:9086/webapp/login またはhttp://localhost:9086/webapp/add または はここに私のサンプルコードです。期待どおりに機能していません。
@Controller
public class IPSLController {
@RequestMapping(value={"/logout/*"},method = RequestMethod.POST)
protected void handleLogoutRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
System.out
.println("........................IPSLController logout request.......................................");
}
@RequestMapping(method = RequestMethod.POST,value={"/*"})
protected void handleRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
System.out
.println("........................IPSLController all request Post.......................................");
}
}
のようにそれらを宣言する必要があり、あなたの質問がある場合は? –
「期待通りに動かない」とはどういう意味ですか? –
私は正しいマッピング値を探しています。上記のコードは期待どおりに動作していません。ログアウト要求はhandleRequestメソッドにも来ています。 – Ankur