龙空技术网

ActiveReports报表控件教程之如何使用JSP程序调用it

慧都科技 196

前言:

今天我们对“php调用jsp”大约比较重视,我们都想要分析一些“php调用jsp”的相关资讯。那么小编在网摘上汇集了一些有关“php调用jsp””的相关资讯,希望小伙伴们能喜欢,你们快快来了解一下吧!

ActiveReports报表解决方以提供.NET报表所需的全部报表设计和管理功能先于同类产品。ActiveReports可在.NET多个平台无缝迁移,也能扩展到Java/PHP/Node.js等Web应用。对IE/Chrome/Firefox/Safari有良好的兼容能力,并支持平板电脑、智能手机等移动设备。

本文主要介绍如何使用JSP程序调用ActiveReports报表。

1.在IIS服务器上部署ActiveReports项目

在Visual Studio 2013中成功编译ActiveReports项目。并将该项目部署至IIS服务器。在Defalu Web Site下新建dotnetar。

应用程序池设置如下:

在前台建立Html页面,调用关键代码

var viewer = GrapeCity.ActiveReports.Viewer({
element: '#viewerContainer',
reportService: {
url: 'WebService1.asmx'
},
uiType: 'desktop',
reportLoaded : function  {
reportsButtons.prop('disabled', false);
}
});

由于是跨域访问,需要打开相关限制。新建Global.asax,增加以下代码

protected void Application_BeginRequest(object sender, EventArgs e)
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
if (HttpContext.Current.Request.HttpMethod == "OPTIONS")
{
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept");
HttpContext.Current.Response.End;
}
}

部署成功后,在浏览器输入

显示页面如下:

2.部署JSP代码至Tomcat服务器

JSP调用代码如下

var viewer = GrapeCity.ActiveReports.Viewer( {
element : '#viewerContainer',
reportService : {
url : ''
},
uiType : 'desktop',
reportLoaded : function {
reportsButtons.prop('disabled', false);
}
});

将WebRoot项目部署至Tomcat下。

3.运行结果

IIS运行如下图:

Tomcat运行如下图:

最新版下载:ActiveReportsv9

本站文章除注明转载外,均为本站原创或翻译

标签: #php调用jsp #jsactivex控件 #php调用net的webservice #jspjs方法调用 #js调用webservice跨域