一、前端代码
//AJAX后台取数据
var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
var url = "/bsoa/config.nsf/GetPhoneNum?openagent";
xmlhttp.Open("POST",url, false);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("setTimeOut","10000");
xmlhttp.Send("ok"); //TransformCgi(
//返回值接收
//var returnDOM = xmlhttp.responseXML;
document.getElementById("result").innerHTML = xmlhttp.responseText
//alert("XML数据 原始文本内容为:" + xmlhttp.responseText);
二、后台代理
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim dc As NotesDocumentCollection
Dim view As NotesView
Dim cdoc As NotesDocument
Set cdoc = s.DocumentContext
parList = Trim(cdoc.GetItemValue("Request_content")(0))
Messagebox parList
Set db=s.CurrentDatabase
Set view=db.GetView("VTableWh2")
Set doc =view.GetFirstDocument
xml="<table class=tableborder width='70%' cellspacing='1' cellpadding='4' align='center' '>"
xml=xml+"<th class='trDescribeCenter'><th class=tdDescribeCenter width=10%>序号</td>"
xml=xml+"<th class='tdDescribeCenter' width=10%>姓名</td>"
xml=xml+"<th class='tdDescribeCenter' width=10%>职务</td>"
xml=xml+"<th class='tdDescribeCenter' width=10%>分机</td>"
xml=xml+"<th class='tdDescribeCenter' width=15%>直线电话</td>"
xml=xml+"<th class='tdDescribeCenter' width=15%>手机</td>"
xml=xml+"<th class='tdDescribeCenter' width=15%>传真</td>"
xml=xml+"<th class='tdDescribeCenter' width=15%>房间号</td></tr>"
temp1=""
i=1
While Not doc Is Nothing
If doc.TSeqNo(0)="01" Then
//安装序号大小 将新的部门名称单独显示为一行
temp1="<tr><td colspan=8 class=tdborder><b>"+ doc.TDepartment(0) +"</b></td></tr>"
temp1=temp1+"<tr><td class=tdborder align=center>"+ doc.TSeqNo(0) +"</b></td>"
Else
temp1="<tr><td class=tdborder align=center>"+ doc.TSeqNo(0) +"</b></td>"
End If
'超链接
'temp1=temp1+"<td class=tdborder >"+doc.name(0)+"</td>"
temp1=temp1+ "<td class=tdborder ><a href=/bsoa/config.nsf/0/"+doc.UniversalID+"?OpenDocument target='_blank'>"+doc.name(0)+"</a></td>"
If doc.HasItem("TRank") Then
temp1=temp1+"<td class=tdborder >"+doc.TRank(0)+"</td>"
Else
temp1=temp1+"<td class=tdborder > </td>"
End If
If doc.HasItem("Tel") Then
temp1=temp1+"<td class=tdborder >"+doc.Tel(0)+"</td>"
Else
temp1=temp1+"<td class=tdborder > </td>"
End If
If doc.HasItem("Tel2") Then
temp1=temp1+"<td class=tdborder >"+doc.Tel2(0)+"</td>"
Else
temp1=temp1+"<td class=tdborder > </td>"
End If
If doc.HasItem("TMTel") Then
temp1=temp1+"<td class=tdborder >"+doc.TMTel(0)+"</td>"
Else
temp1=temp1+"<td class=tdborder > </td>"
End If
If doc.HasItem("Fax") Then
temp1=temp1+"<td class=tdborder >"+doc.Fax(0)+"</td>"
Else
temp1=temp1+"<td class=tdborder > </td>"
End If
If doc.HasItem("TRoom") Then
temp1=temp1+"<td class=tdborder >"+doc.TRoom(0)+"</td></tr>"
Else
temp1=temp1+"<td class=tdborder ></td></tr>"
End If
xml =xml +temp1
Set doc =view.GetNextDocument(doc)
i=i+1
Wend
Messagebox Cstr(i)
xml =xml + "</table>"
cdoc.rtfThemesHtmlMX(0)= xml
' Print "Content-type: text/xml charset=GB2312"
' Print |<?xml version="1.0" encoding="utf-8"?>|
Print "Content-type: text/xml;charset=GB2312" '指定页面编码 注意
Print |<?xml version="1.0" encoding="GB2312"?>| '指定XML文件编码
Print xml
转载于:https://blog.51cto.com/yuejian/1340956