Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Application Server  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 为什么我不能取到web.xml的值?
大概



发贴: 0
积分: 0
于 2003-04-14 16:40 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我用的tomcat是3.3.1
我的web.xml文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>

<servlet>
<servlet-name>
webApp
</servlet-name>
<servlet-class>
cn.shanghai.mycompany.myservlet
</servlet-class>

<init-param>
<param-name>propfile</param-name>
<param-value>/home/postgres/jakarta-tomcat-3.3.1/webapps/myproject/config/init.prop</param-value>
</init-param>
</servlet>
</web-app>

我在servlet的init里getInitParameter("propfile")就是取不到
得到是NULL,servlet的name也无效.
不知道为什么,项目别的都没有问题,开始这个文件在程序里写死的,
现在想把把搬到web.xml里,可是......

请各位达人帮忙!!!!!



作者 Re:为什么我不能取到web.xml的值? [Re:大概]
why

問題兒童

总版主


发贴: 4629
积分: 388
于 2003-04-15 23:36 user profilesend a private message to usersend email to whysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
看來沒有問題Question
唔……用postgres的大概是Linux平台……小的曾經在Win2000不慎用了web.Xml這檔名,測試成功,但是放到Linux上都是錯錯錯啦!會不會是這樣呢?Wink



作者 Re:为什么我不能取到web.xml的值? [Re:大概]
大概



发贴: 0
积分: 0
于 2003-04-16 14:05 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我已经解决了,呵呵

cn.shanghai.mycompany.myservlet.getInitParameter() 不行

webApp.getInitParameter() 可以

呵呵,谢谢!



作者 Re:为什么我不能取到web.xml的值? [Re:大概]
why

問題兒童

总版主


发贴: 4629
积分: 388
于 2003-04-16 19:53 user profilesend a private message to usersend email to whysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
不是用 getServletConfig().getInitParameter() 嗎?
用 cn.shanghai.mycompany.myservlet.getInitParameter() 或 webApp.getInitParameter() 都是另一種寫死吧!Wink




flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923