これは StrutsAction
クラスです。
public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
ActionForward forward = null;
try {
forward = mapping.findForward(request.getParameter("nextPage"));
// response.getWriter().print(request.getSession().getServletContext().getRealPath("."));
} catch (Exception ex) {
ex.printStackTrace();
} finally {
return forward;
}
}
そして、以前に解決された ActionForward インスタンスごとの JSP は次のとおりです。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Description</title>
<script src="/jsp/html5/sencha-touch/sencha-touch.js" type="text/javascript"></script>
<link href="/jsp/html5/sencha-touch/resources/css/sencha-touch.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/jsp/html5/description.js"></script>
</head>
<body>
</body>
</html>
上記のこのファイルからのパスは、Action
クラスの現在の作業ディレクトリに相対的になるように調整されています。ただし、ブラウザには何も表示されません。元のパスに戻す (そして、Action
クラスを介さずに JSP ファイルに直接アクセスする) と、目的のページがブラウザーに出力されます。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Description</title>
<script src="./sencha-touch/sencha-touch.js" type="text/javascript"></script>
<link href="./sencha-touch/resources/css/sencha-touch.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="./description.js"></script>
</head>
<body>
</body>
</html>
[-EDITED-] クラスを通過する必要があるAction
ため、この状況を何とか回避する必要があります。同梱されている JavaScript/CSS ファイル自体が他のファイルを含んでいないため、本当に作業ディレクトリに問題があるのか、どのように関係しているのかはわかりません。
ご意見はありますか?ありがとうございました