初学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编的
/**
* @(#)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编的
解决方案 »
- 各位大侠,紧急求助,JfreeChart怎么做呀???
- 在ADF中用EL表达式计算两个参数的乘积
- struts2标签<s:if >和<s:iterator>的使用
- jsp 保存文件对话框
- struts 逻辑标记小问题,问题解决一定给分!
- 怎么把mysql中的图片查出来然后转换显示在页面上!
- CASTOR 同时获取attribute 和 text值
- 查询主机和本机ip的程序,主程序已经贴出来了。问题如下
- 关于文件下载时,action重复执行的问题
- 关于html解析问题
- js eval 函数 如何进行指数计算
- 我在tomcat里的Server.xml部署web项目报Error instantiating servlet class
正确的目录结构是
homepage
|------WEB-INF
|------web.xml
|------lib
|------classes
|-------com
|-------yeqin
|-------Login.class
|------WEB-INF
|------web.xml
|------lib
|------classes
|-------com
|-------yeqin
|-------Login.class