sun-web.xml中的Context Param问题
我正在使用带有Glassfish 3的netbeans 6.9.1创建一个由少量servlet组成的Web应用程序。
我需要在配置文件中存储数据库连接字符串的值。
根据我的发现,这是使用web.xml文件完成的(sun-web.xml是自动生成的):
<context-param>
<param-name>connectionString</param-name>
<param-value>connection string value in here</param-value>
然后在servlet init()期间使用读入
String conString = context.getInitParameter("connectionString");
但是,当netbeans部署应用程序时,我收到以下错误
SEVERE: DPL8007: Invalid Deployment Descriptors element param-name value connectionString SEVERE: DPL8007: Invalid Deployment Descriptors element param-value valu
知道我在这里做错了什么吗?以下是该文件的完整内容:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Servlet 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
<sun-web-app error-url="">
<context-param>
<param-name>connectionString</param-name>
<param-value>Con value</param-value>
</context-param>
<context-root>/FQEX</context-root>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</sun-web-app>
提前致谢。
没有找到相关结果
已邀请:
2 个回复
遣莫捅炭
DTD中看到
。所以我猜你不应该那样做。将它放在常规
中,它将在那里工作。
岭取