ここに web.xml の url-pattern があります
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
これが私のコントローラーです
@Controller
public class HelloController
{
@RequestMapping("/*.km")
public String handleKm()
{
System.out.println("km ext called");
return "aaa";
}
@RequestMapping("/*.jsp")
public String handleJsp()
{
System.out.println("jsp pages called");
return "bbb";
}
}
/requestMapping/a.km で URL にアクセスしている間、動作し、handleKm() メソッドを呼び出します。しかし、/requestMapping/a.jsp では、handleJsp() を呼び出す必要がありますが、動作しません。結果: HTTP ステータス 404 - /requestMapping/a.jsp。どうして ??
URLパターンを「/」から「/*」に変更すると、両方のメソッドが呼び出されますが、適切なページに到達しません。「org.springframework.web.servlet.view.InternalResourceViewResolver」が機能していない可能性があります。