0

带有 jQ​​uery 的 jsp 页面未提交给 Servlet。servlet 名称是 ChangePIN。这是一个 JSP 页面,它使用 jquery 验证 4 个字符的旧 pin 和新 pin 长度,并将其提交给 servlet 以处理 pin 号。请帮助我。

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Change Password</title>
<link rel="stylesheet" href="http://jquery.bassistance.de/validate/demo/site-demos.css">
</head>
<body>
<form action="ChangePIN" id="myform"  method="post" >
  <table width="100%" height="100%">

            <tr>
                <td colspan="2"><%@include file="atmAdmin.jsp"%></td>
            </tr>

            <tr height="100%">
                <td colspan="2" align="center">
                    <div style="">Enter old and new PIN</div>
                    <table style="font-family: verdana font-size : 38px" align="center">

            <tr>
            <td>    <label for="field">Enter old password </label> </td>
            <td>    <input type="text" class="left" id="oldPin" name="oldPin"></td>
            </tr>

                        <tr>
                            <br>
                            <td></td>
                        </tr>

                                                <td></td>


            <tr>
            <td>    <label for="field">Enter new password </label> </td>
            <td>    <input type="text" class="left" id="newPin" name="newPin"></td>
            </tr>
                        <tr>
                            <br>
                            <td></td>
                            <td align="center"><input type="submit" value="submit">
                        </tr>
            </table>

            <tr width="22px" valign="bottom">
                <td colspan="2"><%@include file="atmFoot.jsp"%></td>
            </tr>

            </table>
</form>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://jquery.bassistance.de/validate/jquery.validate.js"></script>
<script src="http://jquery.bassistance.de/validate/additional-methods.js"></script>
<script>
// just for the demos, avoids form submit
jQuery.validator.setDefaults({
debug: true,
success: "valid"
});
$( "#myform" ).validate({
rules: {
oldPin: {
required: true,
maxlength: 4
},
newPin: {
    required: true,
    maxlength: 4
    }

}
});
</script>
</body>
</html>

我也检查了 web.xml。

<servlet>
    <description></description>
    <display-name>ChangePIN</display-name>
    <servlet-name>ChangePIN</servlet-name>
    <servlet-class>com.wipro.controller.ChangePIN</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>ChangePIN</servlet-name>
    <url-pattern>/jsp/changePin1</url-pattern>
  </servlet-mapping>
4

1 回答 1

0
<servlet>
    <description></description>
    <display-name>ChangePIN1</display-name>
    <servlet-name>ChangePIN</servlet-name>
    <servlet-class>com.wipro.controller.ChangePIN</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>ChangePIN1</servlet-name>
    <url-pattern>changePin1</url-pattern>
  </servlet-mapping>

像这样更改您的 web.xml

于 2013-09-19T10:42:42.170 回答