当前位置: 代码迷 >> Java Web开发 >> servlet
  详细解决方案

servlet

热度:349   发布时间:2008-05-11 09:11:29.0
servlet
我运行个源码。出现下列错误
type Status report

message /JavaLibrary/servlet/sjservlets.LoginProcess

description The requested resource (/JavaLibrary/servlet/sjservlets.LoginProcess) is not available.

我怀疑我的路径有错误?但不知道哪点;
这是我的登陆页面;
<%@ include file="../common/common.jsp" %>
<%  response.setHeader("Cache-Control", "no-cache");
    response.setHeader("Pragma", "no-cahce");
%>
<%@ page language="java"  pageEncoding="GB2312" %>
<html>
<head>
<title>Library Management System : Login</title>
<META NAME="description" CONTENT="">
<META NAME="keywords" CONTENT="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
   A:link                  { text-decoration:  none; font-weight: bold; color: #660033}
   A:active                { text-decoration:  none; font-weight: bold; color: #660033}
   A:visited               { text-decoration:  none; font-weight: bold; color: #336699}
   A:hover                 { text-decoration:  underline; font-weight: bold; color: #FF9999}
.footerLink {  font-family: Arial, Helvetica, sans-serif; font-size: 9pt; font-weight: bold; color: #000099}
-->
</style>
</head>

<body bgcolor="#0099ff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="">
<a name="top"></a>
<%@ include file="../common/header_select.jsp" %>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr bgcolor="#f1f1f1">
    <td width="180" align="left" valign="top">
      <%@ include file = "../common/navi.jsp" %>
    </td>
        <TD width=1 bgColor=#999999><IMG height=1 alt=""
      src="../images/common/1ptrans.gif"
      width=1 border=0></TD>
    <td valign="top" width="100%" bgcolor="#f1f1f1"><center>
<%
    // Checking either had login or not, if not then display login menu
    if (login.isUserLogin()) { %>
    <% out.println("Hey... U already login as: <b>"); %> <jsp:getProperty name="login" property="userID" />
    <% out.println("</b><br>So... wanna to logout?"); %>
    <form name="frmLogout" action="/JavaLibrary/servlet/sjservlets.LogoutProcess" method="post"">
        <input type="submit" name="Submit" value="Logout">
    </form>
<%    } else { %>
  <form name=login action="/JavaLibrary/servlet/sjservlets.LoginProcess" method="post">
    <p><img src="../images/login/header.gif" width="538" height="85"></p>
    <table width=225 border=0 cellpadding=3>
      <tr>
        <td colspan=2>
          <center>
            <font size="+2"><b><img src="../images/login/login.gif" width="85" height="115">Login</b></font>
          </center>
        </td>
      </tr>
      <tr>
        <td>账号:</td>
        <td>
          <input type=text name=loginname>
        </td>
      </tr>
      <tr>
        <td>密码:</td>
        <td>
          <input type=password name=password>
        </td>
      </tr>
      <tr>
        <td colspan=2 align=center>
          <input type=submit value="登陆" name="Submit">
        </td>
      </tr>
    </table>
  </form>
<%    } %>
</center><hr>
<p align="center"><font size="+2"><img src="../images/login/small_logo.gif" width="37" height="46"></font><font face="arial, helvetica" size="-1">(c)
  2008,zzu ych</font> </td>
  </tr>
</table>
<jsp:include page="../common/footer.jsp" flush="true" />
</body>
</html>
这是我的web.xml
<?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">

<web-app>
  <servlet>
    <servlet-name>
      ShowMsg
    </servlet-name>

    <servlet-class>
      coreservlets.ShowMessage
    </servlet-class>

    <init-param>
      <param-name>
        message
      </param-name>
      <param-value>
        Shibboleth
      </param-value>
    </init-param>

    <init-param>
      <param-name>
        repeats
      </param-name>
      <param-value>
        5
      </param-value>
    </init-param>
  </servlet>

   <servlet>
        <servlet-name>LoginProcess</servlet-name>
        <servlet-class>sjservlets.LoginProcess</servlet-class>
    </servlet>
   
      <servlet-mapping>
        <servlet-name>LoginProcess</servlet-name>
        <url-pattern>/LoginProcess</url-pattern>
    </servlet-mapping>
   
    <servlet>
        <servlet-name>FormProcess</servlet-name>
        <servlet-class>sjservlets.FormProcess</servlet-class>
    </servlet>
   
      <servlet-mapping>
        <servlet-name>FormProcess</servlet-name>
        <url-pattern>/FormProcess</url-pattern>
    </servlet-mapping>


</web-app>

我的LoginProcess在WEB-INF\classes\sjservlets下面;
大虾们帮帮啊!!!
搜索更多相关主题的帖子: servlet  

----------------解决方案--------------------------------------------------------
The requested resource (/JavaLibrary/servlet/sjservlets.LoginProcess) is not available.应该是Action请求路径的问题:你这里的路径应该是要跟你xml文件里配置里的一致。
----------------解决方案--------------------------------------------------------
在界面上提示的是什么错误,404还是500如果是404的话那就是你路径有问题.你的servelt没有问题
----------------解决方案--------------------------------------------------------
  相关解决方案