JSP gets the Java object (JavaBean)

Source: Internet
Author: User

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.