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

2024-09-04 03:58

本文主要是介绍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>


这篇关于jsp页面点击页签自动刷新解决方案的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1134932

相关文章

深入浅出Spring中的@Autowired自动注入的工作原理及实践应用

《深入浅出Spring中的@Autowired自动注入的工作原理及实践应用》在Spring框架的学习旅程中,@Autowired无疑是一个高频出现却又让初学者头疼的注解,它看似简单,却蕴含着Sprin... 目录深入浅出Spring中的@Autowired:自动注入的奥秘什么是依赖注入?@Autowired

C#文件复制异常:"未能找到文件"的解决方案与预防措施

《C#文件复制异常:未能找到文件的解决方案与预防措施》在C#开发中,文件操作是基础中的基础,但有时最基础的File.Copy()方法也会抛出令人困惑的异常,当targetFilePath设置为D:2... 目录一个看似简单的文件操作问题问题重现与错误分析错误代码示例错误信息根本原因分析全面解决方案1. 确保

C# LiteDB处理时间序列数据的高性能解决方案

《C#LiteDB处理时间序列数据的高性能解决方案》LiteDB作为.NET生态下的轻量级嵌入式NoSQL数据库,一直是时间序列处理的优选方案,本文将为大家大家简单介绍一下LiteDB处理时间序列数... 目录为什么选择LiteDB处理时间序列数据第一章:LiteDB时间序列数据模型设计1.1 核心设计原则

基于Redis自动过期的流处理暂停机制

《基于Redis自动过期的流处理暂停机制》基于Redis自动过期的流处理暂停机制是一种高效、可靠且易于实现的解决方案,防止延时过大的数据影响实时处理自动恢复处理,以避免积压的数据影响实时性,下面就来详... 目录核心思路代码实现1. 初始化Redis连接和键前缀2. 接收数据时检查暂停状态3. 检测到延时过

SpringBoot3匹配Mybatis3的错误与解决方案

《SpringBoot3匹配Mybatis3的错误与解决方案》文章指出SpringBoot3与MyBatis3兼容性问题,因未更新MyBatis-Plus依赖至SpringBoot3专用坐标,导致类冲... 目录SpringBoot3匹配MyBATis3的错误与解决mybatis在SpringBoot3如果

C++ vector越界问题的完整解决方案

《C++vector越界问题的完整解决方案》在C++开发中,std::vector作为最常用的动态数组容器,其便捷性与性能优势使其成为处理可变长度数据的首选,然而,数组越界访问始终是威胁程序稳定性的... 目录引言一、vector越界的底层原理与危害1.1 越界访问的本质原因1.2 越界访问的实际危害二、基

Python 字符串裁切与提取全面且实用的解决方案

《Python字符串裁切与提取全面且实用的解决方案》本文梳理了Python字符串处理方法,涵盖基础切片、split/partition分割、正则匹配及结构化数据解析(如BeautifulSoup、j... 目录python 字符串裁切与提取的完整指南 基础切片方法1. 使用切片操作符[start:end]2

Linux部署中的文件大小写问题的解决方案

《Linux部署中的文件大小写问题的解决方案》在本地开发环境(Windows/macOS)一切正常,但部署到Linux服务器后出现模块加载错误,核心原因是Linux文件系统严格区分大小写,所以本文给大... 目录问题背景解决方案配置要求问题背景在本地开发环境(Windows/MACOS)一切正常,但部署到

Java中InputStream重复使用问题的几种解决方案

《Java中InputStream重复使用问题的几种解决方案》在Java开发中,InputStream是用于读取字节流的类,在许多场景下,我们可能需要重复读取InputStream中的数据,这篇文章主... 目录前言1. 使用mark()和reset()方法(适用于支持标记的流)2. 将流内容缓存到字节数组

MybatisPlus中removeById删除数据库未变解决方案

《MybatisPlus中removeById删除数据库未变解决方案》MyBatisPlus中,removeById需实体类标注@TableId注解以识别数据库主键,若字段名不一致,应通过value属... 目录MyBATisPlus中removeBypythonId删除数据库未变removeById(Se