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; }

 

 

你可能感兴趣的:(spring mvc)