我已经试过是如何添加消息框,而不是新的窗口,在JSP
First.jsp
<form name = "button" style="VISIBILITY: visible">
<table cellspacing=5 cellpadding=5 bgcolor="lightblue" colspan=2 rowspan=2 align="center">
<TR> <TD> <INPUT TYPE="button" onclick="sub1();hide();" VALUE="DOWNLOAD"></TD>
<script>
function popup()
{
popupWindow = window.open('delete','name','width=300,height=100');
popupWindow.focus();
window.close();
}
delete.jsp
<%
String Pdfpath= session.getAttribute("pdfpath").toString();
File f =new File(Pdfpath);
Boolean flag=false;
if(f.exists())
{
flag=f.delete();
}
else
{
out.println("File not found to delete");
}
%>
<html>
<head>
<title>Delete file in java</title>
</head>
<body>
<%
if(flag==true)
{
out.println("File Has Bean deleted successfully");
}
else
{
out.println("Error: Unable To Delete The File");
}
%>
</body>
</html>
从我的第一个JSP我传递到另一个删除一些路径。 jsp的按钮click.That jsp删除我的目录上的文件,并给出一条消息。我希望该消息来自消息框,同时该窗口不应该来。
我不喜欢在javascript函数中添加所有的删除代码,以便我要换另一个jsp。是否可以隐藏窗口并在delete.jsp页面中只显示确认消息框。我需要一些帮助。
感谢
使用JSTL和EL,就像你可以:) – kayz1 2013-04-04 12:48:31