我已经通过JSP,Javascript,HTML实现了一些公告板系统(= Freeboard)。
它包括查看页面,书写,编辑,删除,。等等。, 但是当我实现删除系统时,发生了一些小麻烦。
我要删除的视图页面被删除,然后返回列表页面,但我想要删除的视图页面列表不会消失。
必须至少再刷新一次(F5键)。
我想立即确认它而不刷新(F5键)谢谢。
此致
----------请参考以下源代码示例" bbs_delete.jsp --------
<%@ page contentType="text/html; charset=UTF-8" language="java" import="java.sql.*"%>
<!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>
<%@ include file="../dbinfo.jsp" %>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<%
String bbs_num = request.getParameter("num");
PreparedStatement pstmt = null;
String SQL = "delete from Freeboard where num = ?";
pstmt = con.prepareStatement(SQL);
pstmt.setString(1, bbs_num);
pstmt.execute(); %>
<script>
alert("the deletion is completed successfully. ");
history.back(-1);
location.href("bbs_list.jsp")
</script>
</html>
答案 0 :(得分:1)
可能这对你有用
window.open("URL of page","_self")
使用此选项导航到该页面,这会将您重定向到所需的URL,您无需刷新(F5)页面。