JSP gets the Java object (JavaBean)
Java Code snippet:
Authreqbean authrep=New Authreqbean (); Authrep.setusercode (Usercode); Authrep.setreporttype ( reporttype); Authrep.setreportcode (Reportcode) Request.setattribute ("Authrep", Authrep); Request.getrequestdispatcher ("login.jsp"). Forward (request, response);
JSP Code snippet:
<%@ page language= "java" contenttype= "text/html; Charset=utf-8 "pageencoding= "Utf-8"%><%@ page import= "Nc.xyzq.uuib.bean.AuthReqBean"%><%String Path=Request.getcontextpath (); String BasePath= Request.getscheme () + "://" +request.getservername () + ":" +request.getserverport () +path+ "/";%><! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >//String usercode = Request.getparameter ("Usercode");//using request to getAuthreqbean user= (Authreqbean) request.getattribute ("Authrep"); String Usercode=User.getusercode (); String reporttype=User.getreporttype (); String Reportcode=User.getreportcode ();%><script type= "Text/javascript" >functionLoginfr () {varUsername = "<%=usercode%>"; varPassword = "<%=userpwd%>"; varreporttype = "<%=reporttype%>"; varReportcode = "<%=reportcode%>"; varSCR = document.getElementById ("Ifr_frbi"); Jquery.ajax ({URL:"/http" +serverip+ ":" +serverport+ "/" +projectname+ "/reportserver?op=fs_load&cmd=sso", DataType:"Jsonp", data:{"Fr_username": Username, "Fr_password":p Assword}, Jsonp:"Callback", timeout:5000, Success:function(data) {if(Data.status = = "Success"){ if(Urltype = = "1") {scr.src= "http://" +serverip+ "" +serverport+ "/" +projectname+ "/reportserver?op=fr_bi&cmd=bi_init&id=" +reportid+ " &show=_bi_show_&createby=-999 "; }Else if(Urltype = = "2") {scr.src= "http://" +serverip+ "" +serverport+ "/" +projectname+ "/reportserver?op=fs_main&cmd=entry_report&id=" +ReportID; }Else if(Urltype = = "3") {scr.src= "http://" +serverip+ "" +serverport+ "/" +projectname+ "/reportserver?reportlet=" +ReportID; } }Else if(Data.status = = "Fail") {alert ("Fail!"); }}, Error:function() {alert ("Single Sign-on failed"); } }); //var scr = document.getElementById ("Ifr_fr"); //scr.src = "url";} </script><style>#ifr_fr {width:84%; height:700px; } </style> Welcome to RZZX1.<input id= "FBI_GJZXT" type= "button" Name= "FBI_GJZXT" onclick= "LOGINFR ();" VALUE = "<%=userpwd%>"/>< iframe id= "Ifr_frbi" name= "Ifr_frbi" frameborder= "0" src= "" ></iframe></body>JSP gets the Java object (JavaBean)