servlet问题?急!帮忙呀!

numen2002 2003-07-25 04:01:11
最近在用servlet开发一个项目,碰到了这样一个问题,点击一条记录前的更新按纽,弹出一个新窗口,然后在新窗口中对要变更的数据项做修改,点击新窗口中的变更后旧窗口中的那条记录并没有更新,我想通过加一段JAVASCRIPT代码通过重载页面实现上述功能,代码为 window.opener.open(),一般open()方法里加的是一个HTML页面的名字,可是现在用的是servlet,页面都是通过java输出的,
旧窗口我已经通过resp.setHeader("refresh",15)实现了15秒页面自动刷新,现在我要实现它的立即刷新。
不知怎样实现?高手们!请不吝赐教!多谢
...全文
43 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
duye 2003-07-25
  • 打赏
  • 举报
回复
重新读数据库取数据,这是唯一科学的办法,不然就重新生成页面,但是更改已经更改过的内容,笨
numen2002 2003-07-25
  • 打赏
  • 举报
回复
各位兄台帮帮忙呀
ashes 2003-07-25
  • 打赏
  • 举报
回复
window.opener.location.reload();
试试看
wind48 2003-07-25
  • 打赏
  • 举报
回复
同连
numen2002 2003-07-25
  • 打赏
  • 举报
回复
以下是部分代码

public class NODE extends HttpServlet
{
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
resp.setContentType("text/html");
PrintWriter out = new PrintWriter(resp.getOutputStream());
Function conNode= new Function();
Connection con;
Statement stmt;
ResultSet results;

Hashtable HasNode= new Hashtable();
Hashtable HasNodename= new Hashtable();
Hashtable color= new Hashtable();
Hashtable oldvalue= new Hashtable();

color.put("1", "<font color='#000080'>");
color.put("10", "(宱)");
color.put("2", "<font color='#666699'>");
color.put("20", "(经)");
color.put("3", "<font color='#008000'>");
color.put("30", "(施)");
color.put("4", "<font color='#FF0000'>");
color.put("40", "(营)");
color.put("5", "<font color='#008080'>");
color.put("50", "(质)");

out.println("<html>");
out.println("<head>");
out.println("<meta http-equiv='Content-Type' content='text/html; charset=shift_jis'>");
out.println("<title>select</title>");
out.println("<SCRIPT>");
out.println("function msover(){");
out.println("event.srcElement.style.backgroundColor='#ccffff';");
out.println("event.srcElement.style.cursor = 'hand';");
out.println("}");
out.println("function msout(){");
out.println("event.srcElement.style.backgroundColor='#FFF6DC';");
out.println("event.srcElement.style.cursor = 'auto';");
out.println("}");
//*************2003-7-24 deng add ************//
out.println("function B1_onclick()");
out.println("{");
out.println("window.opener.open()");
out.println("");
out.println("}");
out.println("</SCRIPT>");
out.println("</head>");
out.println("<body>");
。。。。。。。。。
out.println("<p align=\"center\"><input type=\"button\" value=\"更新\" name=\"B1\" onclick=\"B1_onclick()\"></p>");

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧