jsp代码没有提交给servlet

时间:2013-09-19 10:33:54

标签: java jquery jsp

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

<%@ 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>

1 个答案:

答案 0 :(得分: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