gpt4 book ai didi

jquery - struts2 jquery 指示器对话框

转载 作者:行者123 更新时间:2023-12-01 04:55:22 26 4
gpt4 key购买 nike

我正在使用 struts2 和 jquery 插件构建一个 Web 应用程序。我正在尝试使用 jquery 插件中包含的“指示器”功能。事实上,当用户执行某些操作(按钮单击、列表选择...)时,我想触发一个弹出窗口,显示“正在加载...”。

所以我有这个母版页MasterPage.jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<head>
<s:url id="customTheme" value="/template/themes" ></s:url>
<sj:head defaultIndicator="indictor" jqueryui="true" jquerytheme="warrtheme" customBasepath="%{customTheme}" />
</head>
<body>

<sj:dialog id="indicator"
title="Loading"
autoOpen="false"
modal="true"
resizable="false">
<table>
<tr>
<td>&nbsp;</td>
<td><img src="<s:url value="/images/indicator.gif" />" /></td>
<td>Loading...</td>
</tr>
</table>
</sj:dialog>
</body>
</html>

我有这个常规页面 User.jsp:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>

<div class="content">
<s:url var="openViewUser" namespace="/administration" action="administration_utilisateur_open" />
<sj:a href="%{openViewUser}" id="divUserLink" targets="divUser" indicator="indicator">

<div id="divUser"></div>
</div>

当我单击上面代码中的链接时,弹出窗口不会显示。大家有什么线索吗?

提前致谢。

最佳答案

我想发布适合我的完整代码...

在 MasterPage.jsp 上:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<s:url id="customTheme" value="/template/themes" ></s:url>
<sj:head jqueryui="true" jquerytheme="warrtheme" customBasepath="%{customTheme}" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<script type="text/javascript">
$.subscribe('onBeforeLoading', function(event,data) {
$("#indicator").dialog('open');
});

$.subscribe('onCompleteLoading', function(event,data) {
$("#indicator").dialog('close');
});
</script>
</head>

<body>

<sj:dialog id="indicator"
title="Warning"
autoOpen="false"
modal="true"
resizable="false">
<table>
<tr>
<td>&nbsp;</td>
<td><img src="<s:url value="/images/indicator.gif" />" /></td>
<td>Loading, please wait...</td>
</tr>
</table>
</sj:dialog>

</body>
</html>

在 User.jsp 上:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>

<div class="content">
<s:url var="openViewUser" namespace="/administration" action="administration_utilisateur_open" />
<sj:a href="%{openViewUser}" id="divUserLink" targets="divUser" onBeforeTopics="onBeforeLoading" onCompleteTopics="onCompleteLoading" >Click me</sj:a>
<br/>
<br/>
<div id="divUser"></div>
</div>

关于jquery - struts2 jquery 指示器对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14682103/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com