第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

求助Jquery validation remote失去焦點(diǎn)驗(yàn)證問題

求助Jquery validation remote失去焦點(diǎn)驗(yàn)證問題

倚天杖 2018-12-07 07:40:57
我在用jquery validation做一個簡單的登陸驗(yàn)證,其中用戶名要在失去焦點(diǎn)之后驗(yàn)證是否存在,我就用到了remote,但是程序老是報錯如下: 警告: Could not find action or resultNo result defined for action web.LoginForm and result success?? ?at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:375) 前臺jsp頁面代碼如下: <%@ page language="java" contentType="text/html; charset=UTF-8"?? ?pageEncoding="UTF-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>?? ?<head>?? ??? ?<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">?? ??? ?<script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>?? ??? ?<script type="text/javascript" src="js/jquery.validate.js"></script>?? ??? ?<script type="text/javascript" src="js/jquery.form.js"></script>?? ??? ?<link rel="stylesheet" href="css/screen.css" type="text/css"></link>?? ??? ?<script>?? ?$(document).ready(function() {?? ??? ??? ??? ?var jsonn ="${json}";?? ??? ?if (null!=jsonn && jsonn.length!=0){?? ??? ??? ?alert(jsonn);?? ??? ?}?? ??? ?$("#loginForm").validate( {?? ??? ??? ?rules : {?? ??? ??? ??? ?name : {?? ??? ??? ??? ??? ?required : true,?? ??? ??? ??? ??? ?minlength : 2,?? ??? ??? ??? ??? ?remote: {?? ??? ??? ??? ???? url: "validateData.action",???? //后臺處理程序?? ??? ??? ??? ???? type: "post",?????????????? //數(shù)據(jù)發(fā)送方式?? ??? ??? ??? ???? dataType: "json",?????????? //接受數(shù)據(jù)格式 ??? ??? ??? ??? ???? data: {???????????????????? //要傳遞的數(shù)據(jù)? ???????????????????????? username: function () {??????????????????????????? return $("#name").val();??????????????????????? }?? ??? ??? ??? ?}?? ??? ??? ??? ?},?? ??? ??? ??? ?password : {?? ??? ??? ??? ??? ?required : true,?? ??? ??? ??? ??? ?minlength : 4?? ??? ??? ??? ?}?? ??? ?}?? ??? ??? ?},?? ??? ??? ??? ??? ?messages : {?? ??? ??? ??? ?name : {?? ??? ??? ??? ??? ?remote:"用戶名不存在",?? ??? ??? ??? ??? ?required : "*用戶名不能為空",?? ??? ??? ??? ??? ?minlength : "*用戶名至少是兩位"?? ??? ??? ??? ?},?? ??? ??? ??? ?password : {?? ??? ??? ??? ??? ?required : "*密碼不能為空",?? ??? ??? ??? ??? ?minlength : "*密碼長度至少是4位"?? ??? ??? ??? ?}?? ??? ??? ?}?? ??? ?});?? ?});</script>?? ??? ?<title>登陸頁面</title>?? ?</head>?? ?<body>?? ??? ?<div style="position: absolute; left: 50%; top: 50%;">?? ??? ??? ?<form action="loginForm" method="post" id="loginForm">?? ??? ??? ??? ?<p>?? ??? ??? ??? ??? ?<label style="height: 100px" for="name">?? ??? ??? ??? ??? ??? ?用戶名:?? ??? ??? ??? ??? ?</label>?? ??? ??? ??? ??? ?<input type="text" id="name" name="name" style="width: 150px">?? ??? ??? ??? ?</p>?? ??? ??? ??? ?<p>?? ??? ??? ??? ??? ?<label style="height: 100px" for="password">?? ??? ??? ??? ??? ??? ?密&nbsp;&nbsp;碼:?? ??? ??? ??? ??? ?</label>?? ??? ??? ??? ??? ?<input type="password" id="password" name="password"?? ??? ??? ??? ??? ??? ?style="width: 150px">?? ??? ??? ??? ?</p>?? ??? ??? ??? ?<p>?? ??? ??? ??? ??? ?<input type="submit" value="登陸" id="submit">?? ??? ??? ??? ??? ?<input type="reset" value="重置" id="reset">?? ??? ??? ??? ?</p>?? ??? ?</div>?? ??? ?</form>?? ?</body></html>后臺java代碼如下: public String validateData(){?? ??? ?HttpServletRequest request = ServletActionContext. getRequest();?? ??? ?String username =request.getParameter("username");?? ??? ?System.out.println(username);?? ??? ?if("haha".equals(username)){?? ??? ??? ?this.result=false;?? ??? ?}?? ??? ?else{?? ??? ??? ?this.result=true;?? ??? ?}?? ??? ?return SUCCESS;?? ?}struts配置如下: <package name="web" extends="json-default"> ?<action name="validateData" class="web.LoginForm" method="validateData"> ?????????? <result name="success" type="json"> ?????????????????????? <param name="defaultEncoding">UTF-8</param> ??????????????????????? <param name="root">result</param>?????????? </result> ???????????? <result name="error" type="json">??????????? <param name="defaultEncoding">UTF-8</param>??????????? </result> ??????? </action> ?</package> 請各位大牛哥幫助。
查看完整描述

4 回答

?
長風(fēng)秋雁

TA貢獻(xiàn)1757條經(jīng)驗(yàn) 獲得超7個贊

你打好斷點(diǎn)調(diào)試一下啊,象這樣的問題看清楚異常,在action里面打下斷點(diǎn),很簡單就可以解決的,你錯在action里面的,你把jsp的貼出來誰知道啊。

查看完整回答
反對 回復(fù) 2018-12-16
?
繁花不似錦

TA貢獻(xiàn)1851條經(jīng)驗(yàn) 獲得超4個贊

后臺代碼或struts配置的問題吧,先在瀏覽器里輸入地址訪問弄通再放JS里來。

查看完整回答
反對 回復(fù) 2018-12-16
?
蕭十郎

TA貢獻(xiàn)1815條經(jīng)驗(yàn) 獲得超13個贊

在前臺輸入框里輸入數(shù)據(jù)失去焦點(diǎn)之后,能夠跳轉(zhuǎn)到action里,當(dāng)action執(zhí)行完之后,繼續(xù)調(diào)試就出現(xiàn)上述錯誤了

查看完整回答
反對 回復(fù) 2018-12-16
?
翻翻過去那場雪

TA貢獻(xiàn)2065條經(jīng)驗(yàn) 獲得超14個贊

@中州大道:?

package 節(jié)點(diǎn)上加個namespace="/"試下,網(wǎng)上是有這么說的

查看完整回答
反對 回復(fù) 2018-12-16
  • 4 回答
  • 0 關(guān)注
  • 787 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號