簡體   English   中英

JSP文件在Eclipse中可以正常工作,但在Tomcat / webapps中卻不能

[英]JSP file working fine in Eclipse but not in Tomcat / webapps

我有一個具有三個字段的page.jsp :舊的,新的和確認密碼。 我有一個JavaScript來檢查確認密碼和新密碼是否相同。 當我在Eclipse中測試它時,它可以按要求工作,因此我將其部署在Tomcat / webapps中 但是,當我運行它時,它並不會檢查新密碼並確認密碼字段。

請告訴我該怎么辦?


我的網絡應用的屏幕截圖:

源代碼:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css">
html, body, div, h1, h2, h3, h4, h5, h6, p, img, dl,
  dt, dd, ol, ul, li, table, tr, td, form, object, embed,
  article, aside, command, details, fieldset,
  figcaption, figure, footer, group, header, hgroup, legend
 {
  margin: 0;
  padding: 0;
  border: 0;
  }
html {
  font: 82.5% verdana, helvetica, sans-serif;
  background: #fff;
  color: #333;
  line-height: 1;
  direction: ltr;
  }
  html, body {
  position: absolute;
  height: 100%;
  min-width: 100%;
  } 

  table {
  border-collapse: collapse;
  border-spacing: 0;
  }



  .button {
  min-width: 46px;
  text-align: center;
  color: #444;
  font-size: 11px;
  font-weight: bold;
  height: 27px;
  padding: 0 8px;
  line-height: 27px;
  border-radius: 2px;
  transition: all 0.218s;
  border: 1px solid #dcdcdc;
  background-color: #f5f5f5;
  cursor: default;
  }

  *+html .button {
  min-width: 70px;
  }
  button.button,
  input[type=submit].button {
  height: f1f1f1px;
  line-height: 29px;
  vertical-align: bottom;
  margin: 0;
  }

  .button:hover {
  border: 1px solid #c6c6c6;
  color: #333;
  text-decoration: none;
  transition: all 0.0s;
  background-color: #f8f8f8;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
  }
  .button:active {
  background-color: #f6f6f6;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
  }
  .button:visited {
  color: #666;
  }  
   .button-submit {
  border: 1px solid #3079ed;
  color: #fff;
  text-shadow: 0 1px rgba(0,0,0,0.1);
  background-color: #4d90fe;
  }
  .button-submit:hover {
  border: 1px solid #2f5bb7;
  color: #fff;
  text-shadow: 0 1px rgba(0,0,0,0.3);
  background-color: #357ae8;
  }
  button-submit:active {
  background-color: #357ae8;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
  }

  .footer-bar {
  bottom: 0;
  height: 35px;
  width: 100%;
  overflow: hidden;
  }
  .content {
  padding: 0 44px;
  }

  .table{
    padding: 0 55px
  }
.header
  {
  padding: 10px 20px 5px;
  background:#00AAFF;
  border: 1px solid #e5e5e5;
  height:20px;
  }
</style>
<script type="text/javascript">
function ccheck()
{

newPsw=document.f1.newPsw.value;

old=document.f1.old.value;
confirm=document.f1.confirm.value;

if(old=="" || old==null)
{
alert("Plz. Enter Your old password");
document.f1.old.focus();
return false;
}
if(confirm=="" || confirm==null)
{
alert("Plz. Enter Your confirm Password");
document.f1.confirm.focus();
return false;
}
i
if(newPsw=="" || newPsw==null )
{
alert("Plz. Enter Your new password");
document.f1.newPsw.focus();
return false;

}
if(newPsw!=confirm)
    {
    alert("new password and confirm does not match");
    document.f1.newPsw.focus();
    return false;

    }

return true;
}
</script>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="">
<form name="f1" id="f1" action="checkPassword.jsp" onsubmit="return ccheck()">
        <div align="center" style="padding-top: 30px">
            <table  cellspacing="10" cellpadding="10">
                <tr>
                    <td width="200" height="30"><h5>Old Password</h5></td>
                    <td  height="30"><input name="old" type="password"></td>
                </tr>
                <tr>
                    <td  height="30"><h5>New Password</h5></td>
                    <td  height="30"><input name="newPsw" type="password"></td>
                </tr>
                <tr>
                    <td height="30"><h5>Confirm Password</h5></td>
                    <td  height="30"><input name="confirm" type="password"></td>
                </tr>
            </table>
        </div>
        <div class="footer-bar"  align="center" style="padding-top: 30px">
            <table align="center" >
                <tr >
                    <td width="100" align="center"><input type="submit" class="button button-submit" value="Submit"  /></td>
                    <td width="100" align="center"><input type="reset" class="button button-submit" value="Reset" /></td>
                </tr>
            </table>
        </div>
    </form>
</body>
</html>

在您的問題中,我看到...

if(confirm=="" || confirm==null)
{
  alert("Plz. Enter Your confirm Password");
  document.f1.confirm.focus();
  return false;
}
i
if(newPsw=="" || newPsw==null )
{

那額外的i是一個問題,並且可能導致jsp失敗。 我只是不明白為什么它會在日食中起作用。

旁注:完成此工作后,最好將樣式節分解為.css文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM