`
y806839048
  • 浏览: 1107403 次
  • 性别: Icon_minigender_1
  • 来自: 上海
文章分类
社区版块
存档分类
最新评论

jsp dialog 对话框

    博客分类:
  • jsp
jsp 
阅读更多
=====dialog如果div内容是用table动态拼接的内容多次加载的话会一直累加,除非用form每次都会load新的数据,下面看是动态拼接时如何清除上一次的====
function doDetail(){
alert(000);
var table;
$.ajax({
url:'${ctx}/current-alarm!querySJ.json',
type:'POST',
data:'',
async:false,
success:function(data){
alert(2);
$("#detail-form").append('');
table = '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
table +='<tr><th>创建时间</th><th>状态</th><th>当前处理人</th></tr>';
var detail =eval(data);
alert(detail.length);
if(detail){
alert(detail[0]);
for(var i=0;i<detail.length;i++){
alert(detail[i][0]);
var tr='<tr>';
tr+='<td>'+detail[i][1]+'</td>';
tr+='<td>'+detail[i][2]+'</td>';
tr+='<td>'+detail[i][3]+'</td>';
tr+='</tr>';
table += tr;
}
}
table += '</table>';
$("#detail-form").append(table);
}
});
document.getElementById("detail-form").style.display= "block";
$("#detail-form").dialog({
autoOpen : false,
/////要有滚动条的设置这里具体高度
height : 'auto',
width : 400,
modal : true,
onClose:function(){
$("#detail-form").empty();
////在empty之后会消掉之前的样式,这里再加上
$("#detail-form").attr("style", "display: none;overflow-y:auto;height:100%;");
}
});
$("#detail-form").dialog("open");

alert(table);
}


div里面放什么就会显示什么
<%
   String oui= request.getContextPath() + "/organization!queryOrganizationById.json?id=";

%>



function orgdetail(id) {
alert(11);
//获取数
var ui='<%=oui%>'
var urll =ui+id
alert(urll);
var b;
//用这种ajax只要用ajaxa的上下文交互传值,不要用到action,他可以取代action上下文同名传值的方式
$.ajax({
type : 'get',
url : urll,
dataType : 'json',
success : function(data) {
//load data
b=eval(data[0]);
//注意返回的就是object,可以不eval转,但是要注意是数组,还是单个对象。
//如果返回单个对象,有双引号,可以用list的形式返回,之后用数组取出。
alert("bbb"+b.ip);
alert(data[0].ssqy);
alert(data[0].name);
alert(data[0].ms);
alert(data[0].addres);
$("#form11").form("load", data[0]);  //这里分了两步先用ajax取,后form手动加载这个返回数据
//如果用action同名值映射一步到位
//$("#form11").form("loadData",data[0]);
}
});
//$("#form11").form("load", '/organization!queryOrganizationByIdStruts.json?id='+id); 
document.getElementById("search-form").style.display= "block";";//easyui不具备把div open后设置里面的
//内容也显示,公司的cui会,所以此时手动设置为显示。

$("#search-form").dialog({
hide:true, //点击关闭是隐藏,如果不加这项,关闭弹窗后再点就会出错.
autoOpen : false,
height : 'auto',
width : 400,
modal : true

});
$("#search-form").dialog("open");

//$("#search-form").dialog("open");
// $('#search-form').dialog({  
       // title: 'My Dialog2',  
       // width: 400,  
       // height: 200,  
       // closed: false,  
       // cache: false,  
      //  modal: true 
       
    // }); 这种也可以  


}
<div id="search-form" title="用户节点增加" style="display: none;width: 400px;" >
<cui:form id="form11" name="form" action="" style="width: 400px;">
<div style="float: left;padding-top: 8px;">
<label>&nbsp;用户节点名称:</label>
<cui:input id="name"
name="name" value="" width="200" />
</div>
<div style="float: left;padding-top: 8px;">
<label>&nbsp;用户节点地址:</label>
<cui:input id="ip"
name="ip" value="" width="200" />
</div>
<div style="float: left;padding-top: 8px;">
<label>&nbsp;所属区域:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
<cui:combobox id="ssqy1"
name="ssqy1"  width="200" value=""
emptyText="请选择" data="ssqy" ></cui:combobox>
</div>
<div style="float: left;padding-top: 8px;">
<label>&nbsp;用户节点说明:&nbsp;</label>
<cui:textarea id="ms" name="ms"  width="260"></cui:textarea>
</div>
</cui:form>
</div>


public String queryOrganizationById() {
String id = model.getId();
Organization org = new Organization();
List<Organization> tr = new ArrayList<Organization>();
tr = this.getService().queryOrgById(id);
if (tr.size() > 0) {
org = tr.get(0);

String json = JSONArray.fromObject(org).toString();
HttpServletResponse response = ServletActionContext.getResponse();
;
response.setCharacterEncoding("utf-8");
// ServletOutputStream out = null;
BufferedWriter write = null;
try {
write = new BufferedWriter(new OutputStreamWriter(
response.getOutputStream(), "UTF-8"));
write.write(json);
// out = response.getOutputStream();
// out.write(json.getBytes());
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
// out.flush();
// out.close();
write.flush();
write.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;

} else {
return null;
}

}


=======================一例子===================
包含为什么有些脚本触发函数传值无效,用双引号才可?????????????
全局变量的使用,结合参数循环匹配
空值在jsp中的处理
动态拼接任意table
弹框高度,宽度的设置

//割接通告
var re ;
function gjtg(){
$.ajax({
url:'${ctx}/cut-over-order!getgj.json',
type:'POST',
data:'',
async:false,
success:function(result){ 
$("#gjtg").append('');
var table = '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
re = result.data;

for(var i=0; i<re.length; i++){
var id=re[i].id;
table += '<tr style="height:25px; line-height:25px;">'
+'<td align="left" width="50%" style="padding-left:10px">'+re[i].createtime.substr(0, 16)+'</td>'
=============这边用这种单频号不能调用要传参数的脚本函数,要触发的函数能传参数,用双引号=========
//+'<td class="red" width="50%"><a href="#" title="'+re[i].gjmbhyy+'" style="text-decoration:underline">'+re[i].gjmbhyy.substr(0,+'...</a></td>'
//+'<td class="msg_detal" width="50%" ><a href="javascript:;" title="'+re[i].gjmbhyy+'" style="text-decoration:underline" onclick="doDetail();">'+re[i].gjmbhyy.substr(0,+'...</a></td>'
         +"<td><a href=\"#\" onclick=\"doDetail('"+re[i].id+"')\" style=\"text-decoration:underline\">"+re[i].gjmbhyy.substr(0,+"...</a></td>"
        +'</tr>';
}
table += '</table>';
$("#gjtg").append(table);
}
});
}
function doDetail(id){

$("#xq").append('');
var table = '<table width="100%" border="0" cellspacing="0" cellpadding="0">';



for(var i=0;i<re.length;i++){
if(re[i].id==id){
alert(11);
table += '<tr style="height:25px; line-height:25px;">'
+'<th align="left" width="25%" >割接发起人:</th>';
if(re[i].creator==""||re[i].creator==null){
table += '<td align="left" width="25%" ></td>';
}else{
table += '<td align="left" width="25%" >'+re[i].creator+'</td>';
}
table += '<th align="left" width="25%" >创建时间:</th>';
if(re[i].createtime==""||re[i].createtime==null){
table += '<td align="left" width="25%" ></td>';
}else{
table += '<td align="left" width="25%" >'+re[i].createtime+'</td>';
}
table += '</tr>'
+'<tr style="height:25px; line-height:25px;">'
+'<th align="left" width="25%" >割接负责人:</th>';
if(re[i].currentActors==""||re[i].currentActors==null){
table += '<td align="left" width="25%" ></td>';
}else{
table += '<td align="left" width="25%" >'+re[i].currentActors+'</td>';
}
table += '<th align="left" width="25%" >割接时间:</th>';
if(re[i].gjsj==""||re[i].gjsj==null){
table += '<td align="left" width="25%" ></td>';
}else{
table += '<td align="left" width="25%" >'+re[i].gjsj+'</td>';
}

table +='</tr>'
+'<tr style="height:25px; line-height:25px;">'
+'<th align="left" width="25%" >割接目标和原因:</th>';
if(re[i].gjmbhyy==""||re[i].gjmbhyy==null){
table +='<td align="left" width="25%" ></td>';
}else{
table +='<td align="left" width="25%" >'+re[i].gjmbhyy+'</td>';
}
table +='</tr>'
+'<tr style="height:25px; line-height:25px;">'
+'<th align="left" width="25%" >紧急程度</th>';
if(re[i].jjcd==""||re[i].jjcd==null){
table +='<td align="left" width="25%" ></td>';
}else{
table +='<td align="left" width="25%" >'+re[i].jjcd+'</td>';
}
table +='</tr>';
}
}
table += '</table>';
$("#xq").append(table);
document.getElementById("xq").style.display= "block";
$("#xq").dialog({
autoOpen : false,
height : 'auto',
width : 590,
modal : true,
onClose:function(){
$("#xq").empty();
$("#xq").attr("style", "display: none;overflow-y:auto;height:100%;");
}
});
$("#xq").dialog("open");
}
分享到:
评论

相关推荐

    jQuery Dialog 弹出层对话框插件(可加载url地址)

    **jQuery Dialog弹出层对话框插件:深入解析与应用** jQuery Dialog是jQuery UI库中的一个组件,它提供了一种优雅的方式在网页上创建交互式的弹出层对话框。这个插件不仅允许用户展示信息,还可以加载外部URL内容,...

    jsp页面同时弹出页面和对话框

    在IT领域,特别是Web开发中,使用JSP(JavaServer Pages)进行动态网页设计时,开发者经常需要实现在用户交互过程中弹出特定的页面或对话框来获取输入、展示信息或进行确认操作。本文将详细解析如何在JSP页面中通过...

    art.dialog本页面下载对话框

    在实际开发中,我们可以学习如何将"art.dialog"集成到JSP页面中,设置对话框的样式、内容和行为,以及如何监听和响应用户的操作,如点击下载按钮后的文件下载逻辑和进度反馈。同时,深入研究源码能帮助我们理解其...

    一个Jsp弹出窗口

    对于弹出窗口,常用的函数可能包括`alert()`,`confirm()`或`prompt()`,但这些原生方法通常用于简单的对话框,可能不符合"简单美观易用"的要求。因此,更可能的情况是自定义一个弹出框组件,使用DOM操作来创建和...

    非模态对话框window.showModelessDialog简单示例

    非模态对话框在网页应用中是一个非常实用的设计元素...在实际开发中,还可以考虑使用一些现成的库,如jQuery UI的Dialog组件,它们提供了更丰富的功能和更友好的API,帮助开发者更轻松地实现非模态对话框的创建和管理。

    java dialog弹出层实例

    - 压缩包中的"dialog"文件可能是一个JSP页面,包含了创建对话框的HTML结构和JavaScript代码,或者是一个Java类,实现了与服务器通信以获取或处理对话框相关数据的功能。 总的来说,Java Web中的对话框实现涉及到...

    静态Html、jsp、php等使用element ui最简单直观例子(含table/对话框服及js/css等)

    在HTML、JSP、PHP等动态网页开发中,Element UI 提供了一系列组件,如表格(Table)、对话框(Dialog)、按钮(Button)等,极大地提高了开发效率。本教程将通过几个简单的例子,介绍如何在静态页面和服务器端渲染...

    给页面模态框传值

    jsp页面代码,包含将页面的值(从数据库中查出来的值)传递给模态框,模态框中使用ajax提交修改后的值。此文档不包含java代码,而且是使用struts2框架的

    d另一种树形控件,dialog 另一种活用 用iframd的方式加载其他jsp

    标题中的“d另一种树形控件,dialog 另一种活用 用iframe的方式加载其他jsp”指的是在IT开发中,特别是在Web应用中,如何利用树形控件(tree control)和对话框(dialog)实现更灵活的功能。在这个场景中,开发者...

    把jquery 的dialog和ztree结合实现步骤

    button value=”点击弹出树的dialog对话框” onclick =”getTree()”/&gt; ”ztree” class=”ztree”/&gt; &lt;/body&gt; [removed] function getTree(){ var url = “’xx.html’/&gt;”; var setting={

    jquery popupDialog 使用 加载jsp页面的方法

    综合以上知识点,我们可以总结出使用popupDialog插件结合JSP页面的流程:首先需要引入jQuery和popupDialog插件,然后在适当的时候通过JavaScript触发popupDialog()函数来加载指定的JSP页面,同时确保页面不被浏览器...

    IE7 关闭窗口不弹出对话框

    标题“IE7 关闭窗口不弹出对话框”涉及到的是在使用Internet Explorer 7(简称IE7)浏览器时,如何避免在关闭窗口时出现确认对话框的问题。这通常与JavaScript和浏览器的设置有关,因为大多数浏览器会在用户尝试离开...

    window.showModalDialog模式对话框和 window.open的区别

    例如,`member-admin-new.jsp`可能用于管理员添加新成员的模态对话框,而`select-no-center-people.jsp`可能是一个非模态窗口,让用户从列表中选择不包含中心成员的人员。不过,没有具体的代码内容,只能做出推测。

    Jsp页面使用jquery ui制作弹出层的详细方法

    首先,我们需要理解jQuery UI的核心组件——Modal Dialog(模态对话框),它是jQuery UI中的一个强大工具,可以创建一个阻塞用户界面的弹出窗口,直到用户与对话框交互后才会解除阻塞。这在需要用户确认操作、输入...

    关于jsp网页设计的模态和非模态窗口

    在网页设计中,模态窗口(Modal Dialog)和非模态窗口(Modeless Dialog)是两种常用的对话框类型。模态窗口是一种阻塞式对话框,用户必须首先关闭该对话框,才能继续操作其他部分的网页。非模态窗口则是非阻塞式...

    jquery jscrollpane.js滚动窗口微信聊天对话框

    var api = $('.chat-dialog').data('jsp'); if (api) { api.reinitialise(); } } ``` 在以上代码中,`addNewMessage()`函数接收新消息并将其添加到对话框底部。接着,我们检查聊天对话框是否已经初始化了...

    Window.showDialog详解合集

    在这个例子中,`dialogPage.jsp`是弹出的对话框页面,`window`表示对话框的父窗口,`"dialogWidth:500px;dialogHeight:400px;center:yes;status:no"`是一些配置参数,定义了对话框的大小、居中显示和不显示状态栏。 ...

    表单验证+对话框+日期格式化+日期选择框+select美化js框架

    对话框(Dialog Box)是向用户提供信息或获取用户输入的一种方式,常见的有警告、确认、输入等类型。JavaScript库如jQuery UI或Bootstrap提供了丰富的对话框组件,可以方便地创建模态和非模态对话框,通过CSS定制...

    编辑器(jsp代码示例)

    9. `dialog`:可能包含弹出对话框的相关文件,如文件上传或确认操作。 10. `js`:JavaScript文件夹,存放了编辑器的JavaScript代码,处理用户交互和编辑器逻辑。 这个JSP代码示例编辑器可能涉及的知识点包括: 1. ...

    JAVAWEB使用JSP+Servlet实现商品管理功能,后台为数据库,功能包括商品信息浏览、商品信息详情、商品信息删除及修改。

    在商品删除功能中,使用JavaScript或jQuery的弹窗功能(如jQuery UI的dialog或者Bootstrap的modal)实现删除确认对话框,增加用户体验。 通过以上步骤,我们可以构建一个完整的商品管理系统,结合JSP和Servlet的...

Global site tag (gtag.js) - Google Analytics