| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 636 人关注过本帖
标题:wel.xml配置如下,那里错了?
只看楼主 加入收藏
禹_二
Rank: 1
等 级:新手上路
帖 子:661
专家分:0
注 册:2006-9-13
收藏
 问题点数:0 回复次数:5 
wel.xml配置如下,那里错了?

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright 2004 The Apache Software Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<display-name>Welcome to Tomcat</display-name>
<description>
Welcome to Tomcat
</description>

<!-- JSPC servlet mappings start -->

<servlet>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<servlet-class>org.apache.jsp.index_jsp</servlet-class>
</servlet>
<servlet>
<servlet-name>HelloWorld</servlet-name>
<servlet-class>HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<url-pattern>/index.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>HelloWorld</servlet-name>
<url-pattern>/servlet/helloworld</url-pattern>
</servlet-mapping>
<!-- JSPC servlet mappings end -->
</web-app>

把HelloWorld.class放到webapps\myWeb\WEB-INF\classes下,运行时显示

HTTP Status 404 - /servlet/HelloWorld

--------------------------------------------------------------------------------

type Status report

message /servlet/HelloWorld

description The requested resource (/servlet/HelloWorld) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.16

搜索更多相关主题的帖子: xml wel 
2006-11-15 21:47
lyd8935
Rank: 1
等 级:新手上路
帖 子:219
专家分:0
注 册:2006-5-14
收藏
得分:0 
启动Tomcat
打开 IE 输入 http://localhost:8080/项目名/servlet/HelloWorld
2006-11-15 21:59
禹_二
Rank: 1
等 级:新手上路
帖 子:661
专家分:0
注 册:2006-9-13
收藏
得分:0 

我就是这么作的,结果就是上面显示的问题,文件找不到?


2006-11-15 22:11
yening520
Rank: 1
等 级:新手上路
帖 子:71
专家分:0
注 册:2006-9-14
收藏
得分:0 
>/servlet/helloworld
这个是路径吧

[此贴子已经被作者于2006-11-15 22:27:22编辑过]


2006-11-15 22:26
fyi1106
Rank: 1
等 级:新手上路
帖 子:327
专家分:0
注 册:2006-10-14
收藏
得分:0 

这里
<url-pattern>/servlet/helloworld</url-pattern>
helloworld是小写的。
所以地址也要小写:http://localhost:8080/myWeb/servlet/helloworld
用Tomcat时要小心,大小写是敏感的,对于地址也一样。


JavaScript forever!
2006-11-15 22:29
禹_二
Rank: 1
等 级:新手上路
帖 子:661
专家分:0
注 册:2006-9-13
收藏
得分:0 

谢谢楼上的,我就是没注意大小写,真是太马虎了,也多谢各位的支持!


2006-11-15 22:43
快速回复:wel.xml配置如下,那里错了?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015338 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved