<%@ page language="java" %>
<%@ page contentType="text/html; charset=GBK"
import="java.util.*,
smartbi.sdk.ClientConnector,
smartbi.sdk.service.user.UserManagerService"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
request.setCharacterEncoding("GBK");
// 用户名
String user ="admin";
// 密码
String password = "admin";
// Smartbi链接
String smartbiURL = "http://localhost:18080/smartbi/vision/";
// 创建Smartbi链接对象
ClientConnector conn = new ClientConnector(smartbiURL);
// 建立此连接时,就对smartbi进行了登录
boolean ret = conn.open(user, password);
if (!ret) {
%>
<script>
alert("登录失败!");
</script>
<%
} else {
%>
<script>
alert("登录成功!");
// 获取smartbi的cookie,在集成页面需要传递smartbiCookie值,以保证前后台cookie的一致性
var smartbiCookie = "<%=conn.getCookie()%>";
</script>
<%
}
%>
单点登录成功
<!-- 使用iframe直接访问Smartbi主页或报表资源并在链接上带上smartbiCookie参数 -->
<iframe style='width:100%;height:600px'
src='http://localhost:18080/smartbi/vision/index.jsp?smartbiCookie=<%=java.net.URLEncoder.encode(conn.getCookie()) %>'>
</iframe>
</body>
</html>