初学servlet 用实现servlet接口实现。但是一直访问不到页面 ,求教高手们是什么问题!!!?
程序
/**
* @(#)Login.java
*
*
* @author
* @version 1.00 2012/7/20
*/
package com.yeqin;
import javax.servlet.*;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;
import java.io.*;
public class Login implements Servlet
{
/**
* Method init
*
*
* @param parm1
*
@throws ServletException
*
*/
public void init(ServletConfig parm1) throws ServletException {
// TODO: Add your code here
}
/**
* Method getServletConfig
*
*
* @return
*
*/
public ServletConfig getServletConfig() {
// TODO: Add your code here
return null;
}
/**
* Method service
*
*
* @param parm1
* @param parm2
*
@throws ServletException
@throws IOException
*
*/
public void service(ServletRequest parm1, ServletResponse parm2) throws ServletException, IOException {
// TODO: Add your code here
PrintWriter pw = parm2.getWriter();
pw.println("!!!!!!!!!!!!!");
}
/**
* Method getServletInfo
*
*
* @return
*
*/
public String getServletInfo() {
// TODO: Add your code here
return null;
}
/**
* Method destroy
*
*
*/
public void destroy() {
// TODO: Add your code here
}
}
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/XMLSchema-instance"
xsi:schemaLocation="http:-//java.sun-.-com/xml/ns/javaee
http:-//java.sun.-com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0"
metadata-complete="true">
<display-name>HomePage</display-name>
<description>
HomePage
</description>
<servlet>
<servlet-name> login </servlet-name>
<servlet-class> com.yeqin.Login </servlet-class> </servlet>
<servlet-mapping>
<servlet-name> login </servlet-name>
<url-pattern> /login </url-pattern>
</servlet-mapping>
</web-app>
我访问的是 http:-//127.0.0.1:8080/homepage/login
homepage文件夹有 classes lib web.xml Login.java
classes文件夹有 com
com yeqin
yeqin Login.class
请问问题出在哪???用Jcreator编的
homepage
|------WEB-INF
|------web.xml
|------lib
|------classes
|-------com
|-------yeqin
|-------Login.class