📄 folder_password.jsp
字号:
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%
String fileId = (String)request.getParameter("fileId");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>密码认证</title>
<link rel="stylesheet" href="../css/default.css"/>
<script type="text/javascript">
var req;
function getResult(){
var filePassword = document.getElementById('filePassword').value;
//目前后台的处理采用的是jsp回应消息,这里可以把其改成Servlet进行处理
var url = "checkPassword.action?fileId=<%=fileId%>&filePassword="+filePassword;
httpInitial();
if(req){
//这一段是采用同步的方式请求响应
req.open("GET",url,false);
req.send();
var str = req.responseText;
if(str != 'OK'){
alert(str);
return false;
}
return true;
}
}
function httpInitial(){
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
}
else if (window.ActiveXObject){
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
}
}
}
}
function closeWin(){
window.close();
}
function conditionChange(){
window.opener.location.href = "listFolderFile.action?fileId=<%=fileId%>&filePassword="+document.getElementById('filePassword').value;
document.getElementById('alertForm').style.display = "block";
document.getElementById('inputForm').style.display = "none";
}
</script>
</head>
<body>
<form action="listFolderFile.action" onsubmit="conditionChange()">
<input type="hidden" name="fileId" value="<%=fileId%>">
<div id="inputForm">
<table class="default">
<tr class="title">
<td colspan="2" align="center">该文件已加密,需要访问密码</td>
</tr>
<tr>
<td>文件夹密码:</td>
<td><input name="filePassword" id="filePassword" type="password"></td>
</tr>
<tr>
<td colspan="2" align="center"><input class="btn" type="button" value="密码验证" onclick="conditionChange()"></td>
</tr>
</table>
</div>
<div id="alertForm" style="display:none">
<h3 align="center">密码认证成功!</h3>
<table algin="center" width="100%">
<tr>
<td align="center"><input class="btn" type="button" value="关闭" onclick="closeWin()"></td>
</tr>
</table>
</div>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -