Struts2,在Action中返回refresh的意義

Action中:
return "refresh";

Struts中:    //refresh對應刷新父頁面的頁面
<result name="refresh">/common/core/freshParent.jsp</result>

freshParent://刷新父頁面

    <script language="javascript">
		var returnMessage = '${returnMessage}';
		var parafresh = '${parafresh}';
		if(returnMessage != '')
		{
			alert(returnMessage);
		}
		if(window.dialogArguments!=undefined)
		{//刷新父窗口--window.showModalDialog()
			var src_url = window.dialogArguments.location.href;
			var dynamic_url = '';
			if(src_url.lastIndexOf('?')==-1)
			{
				dynamic_url = src_url + "?time_refresh="+(new Date()).getTime();
			}
			else
			{
				dynamic_url = src_url + "&time_refresh="+(new Date()).getTime();
			}
			if(parafresh == 'true'){
			   window.dialogArguments.location = dynamic_url;
			   window.dialogArguments.location = src_url;
			   window.close();
			}else if(parafresh == 'false'){
			   window.close();
			}
		}
		else
		{//刷新父窗口--window.open()
			if(parafresh == 'true'){
				try{
					window.opener.location.reload();
					window.close();
				} catch(e) {
					window.close();
			    }
			} else if(parafresh == 'false'){
			   window.close();
			} if (parafresh == 'grandRefresh') {
				if (window.opener != null) {
					if (window.opener.parent != null) {
						window.opener.parent.location.href = window.opener.parent.location.href;
					} else if (window.opener.opener != null) {
						window.opener.opener.location.href = window.opener.opener.location.href;
					}
					window.close();
				}
			}
		}
		
   </script>
相關文章
相關標籤/搜索