DWZ + SPRING MVC 框架

DWZ 知识:

dwz-user-guide

F:\skyDrive\文档\Tech Learning\js\DWZ

dwz的程序

F:\skyDrive\文档\Tech Learning\js\DWZ\dwz-ria

dwz spring mvc

F:\skyDrive\文档\Tech Learning\js\DWZ\dwzmvc

JSP页面

action : 请求提交的action

class:指明需要验证的form

onsubmit:提交form表单后 转到的fanction

function validateCallback(form, callback) {
    var $form = $(form);
    
    if (!$form.valid()) {
        return false;
    }
 
     if($("[name=CONFIRM]").attr("value")!=$("[name=NEWPASSWORD]").attr("value")){
    document.getElementById("CONFIRM_EXSIT").innerHTML="<spring:message code="hr.modifypassword.alert.checkpasswordmatch" />";
     return false;
  }
 
 
 $.ajax({
        type: form.method || 'POST',
        url:$form.attr("action"),
        data:$form.serializeArray(),
        dataType:"json",
        cache: false,
         success:  DWZ.ajaxDone,
         error: DWZ.ajaxError
    });        
        return false; 
}
</script>
<div class="panel collapse">
        <h1><spring:message code="hr.modifypassword.title.TITLE"/>
         
        </h1> 
        <div>
            <form   action="/ess/modify/ModifyPassword" class="pageForm required-validate" 
            onsubmit="return validateCallback(this, navTabAjaxDone);"  
            name="modifyPasswordForm" id="modifyPasswordForm" >
                
               <div class="formBar">
                    <ul>
                        <li>
                            <div class="buttonActive">
                                <div class="buttonContent">
                                    <button type="submit">
                                        <spring:message code="ess.infoApply.title.apply"/><!--??-->
                                    </button>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
                <div>
                    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="user_table">
                   
                        <tr>
                            <td class="td_title">
                                <spring:message code="hr.viewPersonalInfo.title.EMPID" />
                                <!--Stuff ID-->
                            </td>
                            <td class="td_type" >
                                <input name="PERSON_ID" id="PERSON_ID" type="text" 
                                      value="${PERSON_ID }" />
                            </td>
                            <td class="td_title">
                                <spring:message code="hr.modifypassword.title.orginal" />
                                <!--Orignal Password-->
                            </td>
                            <td class="td_type" >
                                <input name="PASSWORD" type="text" size="20" 
                                   value="${PASSWORD}" />

                            </td>
                            <td class="td_title">
                                <spring:message code="hr.modifypassword.title.new" />
                                
                                <!--new password-->
                            </td>
                            <td class="td_type" >
                                <input name="NEWPASSWORD" type="text" size="20" class="required alphanumeric textInput" minlength="6" maxlength="10"
                                     />
                                   <span id="NEWPASSWORD_EXSIT" style="color: red"></span>
                            </td>
                            <td class="td_title">
                                <spring:message code="hr.modifypassword.title.confirm" />
                                <!--confirm -->
                            </td>
                            <td class="td_type" >
                                <input name="CONFIRM" type="text" size="30" class="required textInput valid"
                                   maxlength="10"/>
                            <span id="CONFIRM_EXSIT" style="color: red"></span>
                            </td>
                        </tr>
                    </table>
                </div>
            </form>    
        </div>
    </div>

 

JAVA web

//显示页面    
@SuppressWarnings("unchecked")
    @RequestMapping(value = "/viewModifyPassword")
    public ModelAndView viewPaInputItemDataList(HttpServletRequest request,
            HttpServletResponse response, ModelMap modelMap) throws Exception {

        AdminBean admin = SessionUtil.getLoginUserFromSession(request);
        
        modelMap.put("PERSON_ID", admin    .getPersonId());
        modelMap.put("PASSWORD", admin.getPassword());
 
        return new ModelAndView("/ess/modify/viewModifyPassword", modelMap);
    }
//处理form表单提交的action的 方法
@RequestMapping(value = "/ModifyPassword") @ResponseBody public Map modifyPassword( HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws Exception { Map<String, Object> map = new HashMap<String, Object>(); AdminBean admin = SessionUtil.getLoginUserFromSession(request); admin.setPassword(request.getParameter("NEWPASSWORD")); boolean result; try { result = modifyPassWordSer.modifyPassword(request); if (result) { map.put("navTabId", "ess0400"); map.put("message", TipMessage.getTipMessage("alert.message.hr.modifypassword.modifypassword_success",request));//个人密码修改成功 map.put("statusCode", "200"); map.put("callbackType", "closeCurrent"); } else { map.put("message", TipMessage.getTipMessage("alert.message.hr.modifypassword.modifypassword_fail",request));//个人密码修改失败,请重试! map.put("statusCode", "300"); } } catch (Exception e) { e.printStackTrace(); } return map; }

 

 

转载于:https://www.cnblogs.com/cici-new/archive/2013/02/04/2891290.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值