页面刷新有关问题

页面刷新问题
我完成一个动作,完成之后想通过js把页面部分自动刷新,请问怎么实现

------解决方案--------------------
ajax
------解决方案--------------------
部分刷新页面用ajax吧
------解决方案--------------------
JS调用后台方法、在回调函数中刷新指定区域的页面部分。
------解决方案--------------------
用AJAX,给你个原生的小例子吧
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'show.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<script language="javascript">
//定义一个变量用于存放XMLHttpRequest对象
var xmlHttp;


//改函数用于创建一个XMLHttpRequest对象
function createXMLHttpRequest(){
if(window.ActiveXObject){
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}else if(window.XMLHttpRequest){
xmlHttp = new XMLHttpRequest();
}
}


//这是一个启动AJAX异步通信的方法
function getServerTime(){
var now = new Date();//获取系统当前的时间

//创建一个XMLHttpRequest对象
createXMLHttpRequest();
//将状态触发器绑定到一个函数
xmlHttp.onreadystatechange= processServerTime;
//通过GET方法向指定的URL建立服务器的调用,加个临时的参数,以便表示一个全新的请求
var url="getServerTime?tmp="+now.getTime();//等写完回来看这一句话
xmlHttp.open("GET",url,true);
//发送请求
xmlHttp.send(null);
}

//这是一个用来处理状态改变的函数
function processServerTime(){
//定义一个变量用于存放从服务器返回的响应结果
var responseContext;
if(xmlHttp.readyState==4){
//如果响应成功
alert(xmlHttp.status);
if(xmlHttp.status==200){
//取出服务器的响应内容
responseContext=xmlHttp.responseText;
document.getElementById("servertime").innerHTML=responseContext;
}
}
}
/**以上是获取当前时间的**/

//这是一个启动AJAX异步通信的方法
function ajaxLogin(){
var ln = document.getElementById("loginname").value;
var lp = document.getElementById("loginpwd").value;
//创建一个XMLHttpRequest对象
createXMLHttpRequest();

//将状态绑定到一个函数
xmlHttp.onreadystatechange=processAjaxLogin;
//通过GET方法向指定的URL建立服务器的调用
var url="ajax_ajaxLogin.action?loginname="+ln+"&loginpwd="+lp;
xmlHttp.open("GET",url,true);

//发送请求
xmlHttp.send(null);
}
//这是一个用来处理状态改变的函数
function processAjaxLogin(){
//定义一个变量用于存放 从服务器返回的响应结果
var responseContext="";
if(xmlHttp.readyState==4){
if(xmlHttp.status==200){