我正在编写我的第一个Java EE应用程序,使用EJB,Servlet,JSP等。
我使用JBOSS 4.2 AS和Eclipse作为和IDE,包括启动和停止服务器等任务。Servlet发布请求日志到Eclipse控制台
我无法理解的是,虽然记录在JSP中的指令,如:
<% System.out.println("Log this!"); %>
日志如预期,无论是在Eclipse控制台和$SERVER_HOME/server/default/log/server.log
,任何种类的登记指令的我已经试过里面一个servlet失败。
下面是调用这个servlet的JSP代码:
<form action="MyServlet" method="POST" accept-charset="utf-8">
<input type="text" name="id" value="" id="id">
<input type="submit" value="Go →">
</form>
当然并且servlet itslef:
public class MyServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public MyServlet() {
super();
System.out.println("Hi, I'm your servlet's constructor");
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.err.println("Hi, this is your servlet on system.err");
System.out.println("Hi, this is your servlet on system.out");
System.out.println(request);
ServletContext sc = getServletContext();
sc.log("Hi, this is your servlet on servlet context!");
}
}
我失去了一些东西明显?做错了什么,或只是看错了地方?
感谢您的评论。 servlet *正在被执行,但不知何故不是最新的。完全重新发布导致*所有*指令工作湖魅力。 – Agos