免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2843 | 回复: 1
打印 上一主题 下一主题

win2k关于Tomcat 4.1中server.xml和web.xml文件的配置 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-12-22 16:46 |只看该作者 |倒序浏览
我在d:盘中建一个目录myweb
再在此目录下建4个子目录:beans   jsp   servlets  WEB-INF
再在WEB-INF下建1个子目录:classes

想配置能运行beans , jsp , servlets 的环境.
1.怎样设置Tomcat 4.1中conf 下的server.xml文件.
2.怎样设置Tomcat 4.1中conf 下的web.xml文件.
3.怎样设置WEB-INF 下的web.xml文件


我查了其它贴:
http://www.chinaunix.net/jh/26/148405.html
http://chinaunix.net/jh/26/89562.html


1.设置Tomcat 4.1中conf 下的server.xml文件.
        <Context path="/myweb" docBase="d:\myweb" debug="0"
                 reloadable="true" crossContext="true"/>;

2.设置Tomcat 4.1中conf 下的web.xml文件.
    <servlet-mapping>;
        <servlet-name>;invoker</servlet-name>;
        <url-pattern>;/servlet/*</url-pattern>;
    </servlet-mapping>;

3.设置WEB-INF 下的web.xml文件(Test.class已经在WEB-INF 中的classes)
<?xml version="1.0" encoding="ISO-8859-1"?>;

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">;

<display-name>;My Web Application</display-name>;
<description>;
A application for test.
</description>;
<servlet>;
<servlet-name>;Test</servlet-name>;
<display-name>;Test</display-name>;
<description>;A test Servlet</description>;
<servlet-class>;Test</servlet-class>;
</servlet>;
<servlet-mapping>;
<servlet-name>;Test</servlet-name>;
<url-pattern>;/Test</url-pattern>;
</servlet-mapping>;
</web-app>;

bean,jsp和servlet 都不能用.
若删WEB-INF 下的web.xml文件
bean,jsp可用.
但servlets 的Test.class还是找不到.

望申出援手.

论坛徽章:
0
2 [报告]
发表于 2003-12-25 18:49 |只看该作者

win2k关于Tomcat 4.1中server.xml和web.xml文件的配置

Modifying server.xml
The only change that needs to be made to server.xml is to allow Tomcat to automatically reload a servlet if its .class file has been modified. Open server.xml in a text editor and look for the comment
<!-- Define properties for each web application. ...
... -->;
After the close of the comment, and before any <Context>; tags, add the following tag
<DefaultContext reloadable="true"  />;

Modifying web.xml
The only change to make to the web.xml  file is to uncomment the code for the invoker servlet. The invoker servlet allows Tomcat to execute any servlet that is in a directory. Without the invoker servlet, you would need to add information about every servlet to be run in the web.xml file of that directory. Open web.xml in a text editor and look for the following
<!--
<servlet mapping>;
  <servlet-name>;invoker</servlet-name>;
  <url-pattern>;/servlet/*</url-pattern>;
</servlet-mapping>;
-->;
Remove the comments before and after this so that it looks like
<servlet mapping>;
  <servlet-name>;invoker</servlet-name>;
  <url-pattern>;/servlet/*</url-pattern>;
</servlet-mapping>;

Restart Tomcat
After making changes to the configuration files, you will need to stop Tomcat and then start it again.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP