日期:2014-05-16 浏览次数:20418 次
一、项目中应用:
1.PrivInterceptor.java 权限拦截密码过于简单直接跳转至修改密码jsp,且传上次访问的路径requestUrl。
/** * 二、登录成功后,根据URL进行权限判断 */ HttpServletRequest request = ServletActionContext.getRequest(); String currentURL = request.getRequestURI(); if( !"".equals(bussiness_id.trim()) && null!=bussiness_id ) { /** * 2.1判断工号登录后,业务密码是否为123456,是跳转到商户安全设置,修改业务密码 */ TBussinessSafe busSafe = bussiSafeDAO.selectByPrimaryKey(bussiness_id); if( null!=busSafe ) { String MD5password = KeyedDigestMD5.getKeyedDigest("123456","").toUpperCase();//获得123456的MD5值 String bussinessPass2 = busSafe.getBussinessPass2();//获得工号业务密码 if( MD5password.equals(bussinessPass2) ) { String requestUrl = currentURL+(request.getQueryString()==null?"":"?"+request.getQueryString()); act.put("requestUrl", requestUrl);//本次请求的Url act.put("message", "首次登录请设置您的“业务密码”,业务密码将用于保护您的相关资金操作。"); return "updateBussinessPassword"; } }
?2.js调用上次你请求的URL,实现修改完密码后,自动跳转到上一次访问的路径
function doUpdateSave(){ $('#updateForm').dialogSubmit(doValidate(),'SafeManager_motifyPass',null,sussCallBack); } function sussCallBack(data,win){ switch(data){ case '3001': $.hpDialog.alert(errorMessage[data]) ; break case '3002': $.hpDialog.alert(errorMessage[data]) ; $(win.document).find('input[type="password"]').val(''); $(win.document).find('.qr1').html(''); $(win.document).find('#safe\\.newpassErr').removeData('newstate'); var requestUrl = $(win.document).find('#requestUrl'); if(requestUrl){ var from = requestUrl.val(); if(from)win.location.href=from; } break case '3006': $.hpDialog.alert(errorMessage[data]) ; break default: $.hpDialog.alert(errorMessage[data],function(){$.dialog.close();}) ; } }
?3.jsp页面
<%@ include file="/cssBasePage.jsp"%> <script type="text/javascript" src="<%=path%>/jsp/phone/business/safe/passMotify.js"></script> <script type="text/javascript"> </script> </head> <body> <form id="updateForm" name="updateForm"> <input type="hidden" id="initLoadMethod" name="initLoadMethod" value="initsale" /> <input type="hidden" id="requestUrl" name="requestUrl" value="${requestUrl }" /> <div class="cftbox"> <hp:HpNavigate2 hasOperation="true">商户安全设置</hp:HpNavigate2> <div class="xgqh"> <s:if test="message!=''"> <s:property value="message"/> </s:if> </div> <ul> <li><div id="newpasstitle" class="tm">新交易密码:</div><div class="sr"><hp:HpInputPass name="safe.bussinessPass2" id="safe.bussinessPass2" TClass="srinput" TOnBlur="javascript:onBlurValiNewPass(this.value,'safe\\\\.newpassErr')"></hp:HpInputPass></div><div id="safe.newpassErr" class="qr1"></div></li> <li><div id="surepasstitle" class="tm">提交新密码:</div><div class="sr"><hp:HpInputPass name="safe.state" id="safe.state" TClass="srinput" TOnBlur="javascript:onBlurValiSurePass(this.value,'safe\\\\.surepassErr')"></hp:HpInputPass></div><div id="safe.surepassErr" class="qr1"></div></li> <li><div class="tm"></div><div class="sr"><hp:HpButton TJsClick="javascript:doUpdateSave()" TValue="save" id=""></hp:HpButton><hp:HpButton TJsClick="javascript:doReset()" TValue="reset" id=""></hp:HpButton></div></li> </ul> <div style="clear:both"></div> </div> </form> </body> </html>?
?
二、jsp引用文件的两种方式:
?