首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

帮小弟我看下那里错了

2012-03-30 
帮我看下那里错了啊刚开始的登录界面Java code%@ page languagejava importjava.util.* pageEncodi

帮我看下那里错了啊

刚开始的登录界面

Java code
<%@ page language="java" import="java.util.*" pageEncoding="gb2312"%><%    session.invalidate();%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>    <head>        <title>zhong he guan li xi tong</title>        <meta http-equiv="Content-type" content="text/html;charset=gb2312" />        <META content="MSHTML 6.00.2900.3314" name=GENERATOR>        <link href="images/blue.css" rel="stylesheet" type="text/css">        <style type="text/css"><!--body {    background-image: url(images/bg.gif);    margin: 0px;    background-repeat: repeat-x;}table,td {    font-family: "宋体";    font-size: 12px;}.inputtext {    border-left: 1px solid balck;    border-right: 1px solid balck;    border-top: 1px solid balck;    border-bottom: 1px solid balck;}.loginbg {    font-size: 12px;    width: 59px;    height: 26px;    background-image: url(images/login_bg.gif);    border: none;    padding-top: 3px;    color: white;}.font1 {    FONT-SIZE: 12px;    LINE-HEIGHT: 130%;    FONT-FAMILY: "宋体"}.input {    BORDER-RIGHT: #000000 1px solid;    BORDER-TOP: #000000 1px solid;    FONT-SIZE: 12px;    BORDER-LEFT: #000000 1px solid;    COLOR: #000000;    BORDER-BOTTOM: #000000 1px solid;    FONT-FAMILY: "宋体";    BACKGROUND-COLOR: #ffffff}--></STYLE>    </head>    <body bgcolor=#002779>    <script language="javascript">      function form_check(){       if(document.form1.username.value==""){        window.alter("登录名不能为空");        document.form1.username.focus();        return (false);       }       if(document.form1.pwd.value=""){        window.alter("登录密码不能为空");        document.form1.pwd.focus();        return (false);       }      }            function loginclick(){      if(form_check()){       this.form.submit();      }      }    </script>        <table height=600 width="100%" cellSpacing=0 cellPadding=0            align=center border=0>            <tbody>                <tr>                    <td valign=center align=middle>                        <div align=center>                            <table cellSpacing=0 cellPadding=0 width=460 border=0>                                <tbody>                                    <tr>                                        <td>                                            <img height=12 src="images/login_1.jpg" width=50>                                        </td>                                    </tr>                                </tbody>                            </table>                            <TABLE cellSpacing=0 cellPadding=0 width=460 border=0>                                <TBODY>                                    <TR>                                        <TD>                                            <IMG height=109 src="images/login_2_.jpg" width=460>                                        </TD>                                    </TR>                                </TBODY>                            </TABLE>                            <TABLE cellSpacing=0 cellPadding=0 width=460 border=0>                                <TBODY>                                    <TR>                                        <TD bgColor=#eeeeee height=6></TD>                                    </TR>                                </TBODY>                            </TABLE>                            <table cellSpacing=0 cellPadding=0 width=460 border=0>                                <tbody>                                    <tr>                                        <td height=150 align=center bgColor=#ffffff>                                            <table width=260 border=0 cellspacing=0 cellPadding=0>                                                <tr>                                                    <td height=30 align=center>                                                        <font color=#FF6600>系统登陆</font>                                                    </td>                                                </tr>                                                <tr>                                                    <td height="1" align="center">                                                        <img src="images/bj-02.jpg" width="251" height="1">                                                    </td>                                                </tr>                                                <form name="form1" action="login" method="post"                                                    onSubmit="return form_check();">                                                    <input name="reaction" type="hidden" value="chklogin">                                                    <tr>                                                        <td align="center" valign="top">                                                            <table width="75%" align=center height="100%" border=0                                                                cellSpacing=0 cellPadding=0>                                                                <tr>                                                                    <td width="24%" height="30">                                                                        用&nbsp;&nbsp;户:                                                                    </td>                                                                    <td width="76%" height="30">                                                                        <input name="username" type="text" size="15"                                                                            class="inputtext">                                                                    </td>                                                                </tr>                                                                <tr>                                                                    <td height="25">                                                                        密&nbsp;&nbsp;码:                                                                    </td>                                                                    <td height="25">                                                                        <input type="password" name="pwd" size="15"                                                                            class="inputtext">                                                                </tr>                                                                <tr>                                                                    <td height="45" colspan="2">                                                                        <p align=center>                                                                            <input type="submit" value="登 陆" class="loginbg">                                                                            <input type="reset" value="取 消" class="loginbg">                                                                    </td>                                                                </tr>                                                                </form>                                                            </table>                                                        </td>                                                    </tr>                                                    </tbody>                                            </table>                                            <TABLE cellSpacing=0 cellPadding=0 width=460 bgColor=#ffffff                                                border=0>                                                <TBODY>                                                    <TR>                                                        <TD>                                                            <IMG height=10 src="images/login_3.gif" width=10>                                                        </TD>                                                        <TD align=right>                                                            <IMG height=10 src="images/login_4.gif" width=10>                                                        </TD>                                                    </TR>                                                </TBODY>                                            </TABLE>                                            </div>                                        </td>                                    </tr>                                </tbody>                            </table>    </body></html> 



web
XML code
<?xml version="1.0" encoding="UTF-8"?><web-app version="2.5"     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_2_5.xsd">      <servlet>    <servlet-name>login</servlet-name>    <servlet-class>org.gl.Login</servlet-class>  </servlet>    <servlet-mapping>   <servlet-name>login</servlet-name>   <url-pattern>/login</url-pattern>  </servlet-mapping>        <welcome-file-list>    <welcome-file>default.jsp</welcome-file>  </welcome-file-list></web-app>


index.jsp 就是一个输出一句话

最后login

Java code
<?xml version="1.0" encoding="UTF-8"?><web-app version="2.5"     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_2_5.xsd">      <servlet>    <servlet-name>login</servlet-name>    <servlet-class>org.gl.Login</servlet-class>  </servlet>    <servlet-mapping>   <servlet-name>login</servlet-name>   <url-pattern>/login</url-pattern>  </servlet-mapping>        <welcome-file-list>    <welcome-file>default.jsp</welcome-file>  </welcome-file-list></web-app>



我运行以后default.jsp可以进入点击登录后跳转,但是页面是空白,后台也没有报错,地址是gloa/login,好像是没进入servlet

请问如何解决



[解决办法]
if(document.form1.username.value==""){
window.alter("登录名不能为空");
document.form1.username.focus();
return (false);
}
if(document.form1.pwd.value=""){
window.alter("登录密码不能为空");
document.form1.pwd.focus();
return (false);
}
一个== 一个= 什么意思?

热点排行