| Summary: | Can't access web.xml init-param values when running servlet. | ||
|---|---|---|---|
| Product: | [WebTools] WTP ServerTools | Reporter: | Chris Back <chris.back> |
| Component: | jst.server | Assignee: | Larry Isaacs <larryisaacs> |
| Status: | RESOLVED INVALID | QA Contact: | Angel Vera <arvera> |
| Severity: | normal | ||
| Priority: | P3 | CC: | ccc |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
|
Description
Chris Back
I made a mistake in posting the java code... the line
output.println("sampleParam:" + sample-param);
should read
output.println("sampleParam:" + sampleParam);
The "bug" still exists, I just made the mistake when copying sample code to the bug report.
Sort of resolved. If I put the parameter in the context.xml inside the META-INF directory things work as expected. It seems I should close this ticket and instead pursue the difference between the places in the servlet spec. Larry, this is already resolved, but in case you can provide some more insights. I believe you want ServletConfig.getInitParameter() or Servlet.getInitParameter() to read the init-parameter local to a servlet. Calling ServletConfig.getServletContext().getInitParameter() gets "context wide" init parameters, i.e. <context-param> parameters. You would think they would call it getContextParameter(), but they didn't. Feel free to post a question on the Tomcat Users mailing list or the Web Tools newsgroup before reporting such "mysteries" as a bug. :) Changing the resolution to INVALID since nothing in WTP needed fixing. |