恳请高手帮忙 问个简单的初级问题
这个是welcome.html放在root(tomcat6.0)目录下
<html>
<head> <title> Welcome you! <title> </head>
<body>
<form action= "welcome " method= "get ">
请输入姓名 <input type= "text " name= "user ">
<input type= "submit " value= "提交 ">
</form>
</body>
</html>
下面是写的servlet WelcomeYou.java
import
java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.*;
import javax.servlet.http.*;
public class WelcomeYou extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse resp)throws
IOException {
String user=req.getParameter( "user ");
String welcomeInfo= "welcome you "+user;
resp.setContentType( "text/html ");
PrintWriter out=resp.getWriter();
out.println( " <html> <head> <title> ");
out.println( "Welcome Page ");
out.println( " <title> <head> ");
out.println( " <body> ");
out.println(welcomeInfo);
out.println( " <body> <html> ");
out.close();
}
}
编译后的class文件放在了root目录下的WEB-INF目录下的classes目录下
WEB-INF的下的web.xml我配置如下
<?xml version= "1.0 " encoding= "ISO-8859-1 "?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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/javaee "
xmlns:xsi= "http://www.w3.org/2001/XMLSc