私はEclipseを使ってサーブレットをプログラムしています。今、サーブレットのようなことをしたいexample.jsp
(ServletConfig、ServletContext、...の属性またはパラメータにアクセスする)
example.jsp を WebContent の上に置き、プロジェクト名は ProjectExample です。
web.xml で、このサーブレットを宣言する方法は次のとおりです。
<servlet>
<servlet-name>JSP Example</servlet-name>
<jsp-file>example.jsp</jsp-file>
<init-param>
<param-name>name</param-name>
<param-value>hqt</param-value>
</init-param>
// I meet warning at <jsp-file>: that doesn't found this file
//although I have change to: `/example.jsp`, `ProjectExample/example.jsp` or `/ProjectExample/example.jsp`
</servlet>
Container はこのファイルを認識しないため、使用するgetServletConfig().getInitParameter("name")
と null が返されます !!!
これを修正する方法を教えてください。
ありがとう :)
@: コードに何か間違った入力があっても、それはただのタイプミスなので問題ありません。StackOverFlow でコピー/貼り付け機能が許可されなくなった理由がわかりません。