jsp页面点击页签自动刷新解决方案

问题:在一个projectInfoMain.jsp的界面定义了多个页签,怎么实现在一个页签的jsp页面保存完以后点击每个页签时自动刷新改界面。


解决方案:可以在每次点击页签时,修改页签的url地址,使它再次向服务器发送请求,以实现自动刷新的功能


具体解决方案:

projectInfoMain.jsp主界面实现代码:

<%@ page language="java" contentType="text/html; charset=GBK"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>

<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>

<%@ taglib uri="/WEB-INF/cvicse-param.tld" prefix="param"%>

<%@ taglib uri="/WEB-INF/cvicse-common.tld" prefix="common"%>

<%@ taglib uri="http://www.cvicse.com/tags-webui" prefix="webui"%>

<%

	response.setHeader("Pragma", "no-cache");

	response.setHeader("Cache-Control", "no-cache");

	response.setDateHeader("Expires", 0);

	String showFlag = (String)request.getAttribute("showFlag");

	String path=request.getContextPath();

%>

<html>

<head>

<title>项目信息</title>

<webui:dojo />

<common:theme/>

<script>

	function flush(prjnodd,flg){

		if(prjnodd==""){

			return;

		}

		with(document.forms(0)){

			//防止页面不刷新URL添加时间

			 var time = new Date(); 		

			if(""==prjnoid.value){

				prjnoid.value=prjnodd;

				tabpage1.tabPage.url="<%=request.getContextPath()%>/dc/projectInfoAction.do?operAtt=addPrj&prjno="+document.getElementById("prjnoid").value+"&time="+time;

				tabpage2.tabPage.url="<%=request.getContextPath()%>/dc/retamtModelAction.do?prjno="+document.getElementById("prjnoid").value+"&time="+time;

				tabpage4.tabPage.url="<%=request.getContextPath()%>/dc/schemeQueryAction.do?operAtt=queryIrr&isClose=1&prjno="+document.getElementById("prjnoid").value+"&time="+time;

				tabpage5.tabPage.url="<%=request.getContextPath()%>/dc/schemeQueryAction.do?operAtt=queryIrr&ajustFlag=1&isClose=1&prjno="+document.getElementById("prjnoid").value+"&time="+time;

			}else if(flg!="0"){

				    if(flg=="1"){

					   tabpage2.tabPage.url="<%=request.getContextPath()%>/dc/retamtModelAction.do?prjno="+document.getElementById("prjnoid").value+"&time="+time;

					}

					if(flg=="2"){

					   tabpage1.tabPage.url="<%=request.getContextPath()%>/dc/projectInfoAction.do?operAtt=addPrj&prjno="+document.getElementById("prjnoid").value+"&time="+time;

					}			

					tabpage4.tabPage.url="<%=request.getContextPath()%>/dc/schemeQueryAction.do?operAtt=queryIrr&isClose=1&prjno="+document.getElementById("prjnoid").value+"&time="+time;

					tabpage5.tabPage.url="<%=request.getContextPath()%>/dc/schemeQueryAction.do?operAtt=queryIrr&ajustFlag=1&isClose=1&prjno="+document.getElementById("prjnoid").value+"&time="+time;

				

			}

			

		}

		

	}

	function toBack(){

		document.location.href="/lbms/dc/projectInfoAction.do";

	}

	function getProjectId(){

		with(document.forms(0)){

			return prjnoid.value;

		}

	}

	function changeEvent(){

		dojo.require("xcom._base.event");

		xcom.publish("dc.prjSave", [ {

			saveState :"success"

		}, window ]);

		

	}

</script>

</head>

<body style="width:100%;height:100%;overflow:hidden;margin:0em" >

<common:form action="projectInfoAction.do">

<common:hidden name="projectinfoForm" property="operAtt"/>

<common:hidden name="projectinfoForm" property="prjno" styleId="prjnoid"/>

	<table style="width:100%;height:100%"  cellpadding="0"   border="0" 

		cellspacing="0">

		<tr> 

			<td>

		<common:tabpane styleId="tabpane1"

			cookie="false">

			<common:tabpage styleId="tabpage1" title="报价台账基本信息">

		    	  projectInfoAction.do?operAtt=addPrj&prjno=<bean:write name="projectinfoForm" property="prjno"/>

			</common:tabpage>

			<common:tabpage styleId="tabpage2" title="约定还款明细">

				retamtModelAction.do?prjno='+document.getElementById("prjnoid").value+'

			</common:tabpage>

			<common:tabpage styleId="tabpage3" title="租金计划表">

				retamtTabAction.do?operAtt=query&queryFlg=1&isShow=1&prjno='+document.getElementById("prjnoid").value+'

			</common:tabpage>

			
		</common:tabpane>

	</td>

	</tr>

</table>

</common:form>

</body>

</html>

举出一个页签对应的jsp页面

<%@ page language="java" contentType="text/html; charset=GBK"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/cvicse-param.tld" prefix="param"%>
<%@ taglib uri="/WEB-INF/cvicse-common.tld" prefix="common"%>
<%@ taglib uri="http://www.cvicse.com/tags-webui" prefix="webui"%>
<%@ taglib uri="http://www.cvicse.com/tags-event" prefix="event"%>
<%@page import="com.cvicse.lms.smn.retamt.action.RetamtModelForm"%>
			 	 
<%
	response.setHeader("Pragma", "no-cache");
	response.setHeader("Cache-Control", "no-cache");
	response.setDateHeader("Expires", 0);
	String path=request.getContextPath();
%>
<%
	RetamtModelForm retamtModelForm = (RetamtModelForm) request.getAttribute("retamtModelForm");
	//System.out.println(retamtModelForm.getRevRateStr());
%>
<html>
<head>
<script language="JavaScript" src="<%=path%>/js/ajaxbase.js"></script>
<common:theme />
<webui:dojo />
<script type="text/javascript">	





dojo.addOnLoad(function() {	
	
	
	parent.changeEvent();
	
	xcom.subscribe("dc.prjSave", null, function(event, source) {
		//alert(event.saveState);
		if (event.saveState == "success") {
			document.forms[0].validatorGroup.needValidate = false;
			document.forms[0].validatorGroup.needEmptyValidate = false;
			document.forms[0].operAtt.value="";
			with(document.forms(0)){
				if(prjno.value==""){
					prjno.value=parent.getProjectId();
				}
			}
			document.forms[0].submit();
		}
	});
	}

);
function changeEvent(){
	dojo.require("xcom._base.event");
	xcom.publish("dc.prjvSave", [ {
		saveState :"success"
	}, window ]);
	dojo.require("xcom._base.event");
	xcom.publish("dc.retSave", [ {
		saveState :"success"
	}, window ]);
	dojo.require("xcom._base.event");
	xcom.publish("dc.irrSave", [ {
		saveState :"success1"
	}, window ]);
	
}
function toQuery(){                                
	document.forms[0].validatorGroup.needValidate = false;
	document.forms[0].validatorGroup.needEmptyValidate = false;
	document.forms[0].operAtt.value="";
	with(document.forms(0)){
		if(prjno.value==""){
			prjno.value=parent.getProjectId();
		}
	}
	document.forms[0].submit();
}
function toBack(){
	parent.toBack();
}
</script>
<title></title>

</head>
<body style="width: 100%; height: 100%; margin: 0em" >
<common:form action="retamtModelAction.do">
	
</common:form>
<script>
	var editableTable = null;
	
	function toSave() {
		
	
		with (document.forms(0)) {
			operAtt.value = "saveLx";
			submit();
		}
		
		parent.changeEvent();
		
		parent.flush(document.getElementById('prjno').value,"2");
		
	}

	
	}
</script>
</body>
</html>


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

李晓LOVE向阳

你的鼓励是我持续的不断动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值