web.xml里面可以定義兩種參數:
(1)application范圍內的參數,存放在servletcontext中,在web.xml中配置如下: ![]() ![]() ![]() ![]() (2)servlet范圍內的參數,只能在servlet的init()方法中取得,在web.xml中配置如下: ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 在servlet中可以通過代碼分別取用: ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 第一種參數在servlet里面可以通過getServletContext().getInitParameter("context/param")得到 |
web.xml里面可以定義兩種參數:
(1)application范圍內的參數,存放在servletcontext中,在web.xml中配置如下: ![]() ![]() ![]() ![]() (2)servlet范圍內的參數,只能在servlet的init()方法中取得,在web.xml中配置如下: ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 在servlet中可以通過代碼分別取用: ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 第一種參數在servlet里面可以通過getServletContext().getInitParameter("context/param")得到 |