第一步:页面index.jsp,里面有一个链接(or超链接),例如
<td><a οnclick="fileInfo('${aData.id }')">${aData.id }</a></td>
js代码如下
function fileInfo(id){
var url = '${ctx}/studentQuery/sQuery?id='+id;
$('#iframe').attr('src',url);
$('#modalDetail').modal("show");
}
index.jsp引入模态框modelDetail.jsp,点击连接的时候弹框
<%@ include file="/WEB-INF/jsp/student/modalDetail.jsp" %>
modelDetail.jsp页面如下
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<style>
#modalDetailMx{
top:9%;
}
</style>
<!-- 模态框(Modal) -->
<div class="modal fade" id="modalDetailMx" tabindex="-1" role="dialog" data-backdrop="static">
<div class="modal-dialog" style="width:1160px;height:410px;">
<div class="modal-content">
<div class="modal-header" style="text-align:center;">
<h4 class="modal-title" id="modalDetailLabel">
File Information
</h4>
</div>
<div class="modal-body" id="modalDetailContent" >
<iframe id="iframe" name="content" style="width: 100%;height: 100%;border: 0px;" >
</iframe>
</div>
<div class="modal-footer" style="text-align:center;">
<button type="button" class="btn btn-inverse"
data-dismiss="modal">
<spring:message code="fpcx.gb"/>
</button>
</div>
</div>
</div>
</div>
</body>
</html>
通过action指定跳转的jsp,将该jsp内容引入到了modelDetail.jsp
@RequestMapping(value = "/sssQuery", method = RequestMethod.GET)
public String studentQueryForm(Student student,Model model,HttpServletRequest request, HttpServletResponse response) throws Exception{
return "student/uploadMx";
}
uploadMx.jsp页面可以写自己需要的内容 ,可以是表格等 ,此处省略。