Skip to Content
0
Former Member
Aug 25, 2010 at 03:28 AM

BO 中 OpenDocument.jsp 直接打开报表 而避开登陆的问题。

163 Views

我希望直接打开URL查看报表,而避免登陆.请教大家,谢谢。

比如:http://server8080/OpenDocument/opendoc/openDocument.jsp?iDocID=5566

我的代码如下【验证方式是 SAP验证】,每次这代码还会弹出一个登陆验证框,输入密码后才能登陆,

很郁闷,难道我传递的stoken参数没起作用?

我希望避开验证密码框而直接登录。 谢谢大家

我的test.jsp放在 OpenDocument/opendoc/ 目录下。

对应代码如下

<%@ page import="com.crystaldecisions.sdk.framework.*" %>

<%@ page import="com.crystaldecisions.sdk.exception.SDKException" %>

<%@ page import="com.crystaldecisions.sdk.occa.pluginmgr.IPluginFactory"%>

<%

boolean loginSuccessful = false;

IEnterpriseSession boEnterpriseSession = null;

String SAPSystemId = "BWD";

String SAPClientId = "900";

String SAPUsername = "BOU";

String username = SAPSystemId + "~" + SAPClientId + "/" + SAPUsername;

String password = "654321";

String cmsname = "ITTEST:6400";

String authenticationType = "secSAPR3";

try {

//Log in.

boEnterpriseSession = CrystalEnterprise.getSessionMgr().logon(username, password, cmsname, authenticationType);

if (boEnterpriseSession == null) {

out.print("Unable to login.");

} else {

loginSuccessful = true;

}

} catch (SDKException sdkEx) {

out.print("ERROR ENCOUNTERED" + sdkEx + "");

}

if (loginSuccessful){

ILogonTokenMgr boLogonTokenMgr = boEnterpriseSession.getLogonTokenMgr();

String logonToken = boLogonTokenMgr.createLogonToken("", 60, 1);

String infoViewURL =null;

String tokenParam =null;

String redirectURL =null;

infoViewURL="http://server:8080/OpenDocument/opendoc/logon.jsp";

tokenParam = "ivsLogonToken=" + logonToken;

redirectURL = infoViewURL + "&" + tokenParam;

//response.sendRedirect(redirectURL);

String sdocid= "5566";

pageContext.forward("openDocument_oa.jsp?iDocID="sdocid"&token="+tokenParam);

}

%>