1. 程式人生 > >javascript 前臺加密和後臺接受解密

javascript 前臺加密和後臺接受解密

function subNew3(){

var patPnr = document.getElementById("patPnr").value;

if(patPnr ==""){

alert("黑屏匯入資訊不能為空!");

return;

}

var patPnrEncode = encodeURIComponent(patPnr);

document.getElementById("patPnrEncode").value = patPnrEncode;

document.getElementById("patPnr").value = "";

document.applyForm3

.submit();

}

String patPnrEncode = request.getParameter("patPnrEncode");

logger.info("------------ patPnr解密前的內容為:------------"+patPnrEncode);

try {

patPnr = URLDecoder.decode(patPnrEncode,"UTF-8");

logger.info("------------ patPnr解密前的內容為:------------"+patPnr);

} catch (UnsupportedEncodingException e) {

logger.info("------------ patPnr解密時出現異常:------------");

e.printStackTrace();

request.setAttribute("img", "icon_wrong.gif");

request.setAttribute("errMsg", "將匯入黑屏資訊加密後,解密時出錯!");

return"errorinfo";

}

<!-- -->