1
从servlet上下文获取init参数我试图获取web.xml
文件中定义的init parameter
的值。但我得到了Http Status 500
例外。无法使用EL
代码来获得init parameter
在JSP文件:
init param: ${pageContext.servletContext.initParameter.mob}
的web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<welcome-file-list>
<welcome-file>one/index.html</welcome-file>
</welcome-file-list>
<context-param>
<param-name>mob</param-name>
<param-value>nokia</param-value>
</context-param>
</web-app>
是没有问题的,当我尝试使用JSP语法来获得初始化参数不EL。但是EL引起的错误。谁能告诉我如何得到这个使用EL
什么是你的问题? – confile 2015-02-10 22:33:31
@confile这是一个问题 - >无法从jsp中使用EL在web.xml中获取init参数值。 – JPG 2015-02-10 22:52:41
使用EL表达式从servlet上下文获取init参数。 – 2015-04-26 16:40:30