次のように、SpringMVCコントローラーを使用してJavaScriptを生成します。
@RequestMapping(value="path/to/handler", method = RequestMethod.GET, produces ="text/javascript")
public ModelAndView getJs(HttpServletRequest request) {
String contextPath = request.getContextPath();
return new ModelAndView("/path/to/js/", "contextPath", contextPath);
}
ただし、javascriptリソースのビューリゾルバーを設定する方法がわかりません。誰かがjsリソースのビューリゾルバーを設定する方法をアドバイスできますか?