将javaScript对象传递给modal,转换列表<;Obj>;并传递给JS不起作用
我有一个带有表和行的JSP。一列中的超链接是一个POJO列表,单击该列表将打开一个模式窗口。下面是代码将javaScript对象传递给modal,转换列表<;Obj>;并传递给JS不起作用,javascript,ajax,jsp,modal-dialog,Javascript,Ajax,Jsp,Modal Dialog,我有一个带有表和行的JSP。一列中的超链接是一个POJO列表,单击该列表将打开一个模式窗口。下面是代码 JavaScript代码是 function openModalShowFileList(fileList){ alert(fileList); openModalCreateFiles(); } function openModalCreateFiles(){ openGenModelPopUp('MaskedDiv','ModalPopupOpe
JavaScript代码是
function openModalShowFileList(fileList){
alert(fileList);
openModalCreateFiles();
}
function openModalCreateFiles(){
openGenModelPopUp('MaskedDiv','ModalPopupOpenFiles');
}
function openGenModelPopUp(primary, secondary)
{
document.getElementById(secondary).style.visibility='visible';
document.getElementById(secondary).style.display='';
document.getElementById(secondary).style.top= Math.round ((document.documentElement.clientHeight/2)+ document.documentElement.scrollTop)-180 + 'px';
document.getElementById(secondary).style.left=Math.round ((document.documentElement.clientWidth/2))-450 + 'px';
document.getElementById(secondary).style.display='';
document.getElementById(primary).style.visibility='visible';
document.getElementById(primary).style.top='0px';
document.getElementById(primary).style.left='0px';
document.getElementById(primary).style.width= document.documentElement.clientWidth + 'px';
document.getElementById(primary).style.height= document.body.clientHeight+ 'px';
}
掩码div是一个包含的JSP类
<%
Utility myUtil = new Utility();
String contextPath = request.getContextPath();
%>
<script>
function CloseGenModelPopup(primary, secondary)
{
document.getElementById (primary).style.display='none';
document.getElementById (secondary).style.display='none';
}
</script>
<div id="MaskedDiv" class ="MaskedDiv"></div>
<div id="ModalPopupOpenFiles" class="ModalPopup">
<div id="divHeader">
List of Files in this Folder:
</div>
<br>
<form name="fileList" method="POST">
<table></table>
</form>
</div
函数CloseGenModelPopup(主、辅)
{
document.getElementById(primary.style.display='none';
document.getElementById(secondary.style.display='none';
}
此文件夹中的文件列表:
关键是在浏览器接收到已生成的响应后,实现在何时何地执行代码—服务器上的JSP,请求和呈现页面时(即在响应发送到浏览器之前),以及浏览器中的Javascript。@Jozef Chocholacek modal已加载,但在加载JSP时被屏蔽。因此,该模式中的getAttribute最初为null。当模式打开时,单击按钮ajax调用和setAttribute将不会有任何效果,因为在呈现JSP时已经加载了它。在模式中是否有其他通过ajax渲染的选项?
<a href="javascript:openModalShowFileList([com.abc.Files@6a145f56])">1</a>