• Jsp获取Java的对象(JavaBean)


    Jsp获取Java的对象(JavaBean)

    Java代码片段:

    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代码片段:

    <%@ 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">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <base href="<%=basePath%>">
    <title>正在跳转 ..</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <script type="text/javascript" src="<%= path %>/scripts/jquery-1.7.2.min.js"></script>      
    <% 
    //String usercode = request.getParameter("usercode");//用request得到 
    AuthReqBean user=(AuthReqBean)request.getAttribute("authRep");
    String usercode = user.getUserCode();
    String reporttype = user.getReportType();
    String reportcode = user.getReportCode();
    %>
    <script  type="text/javascript">  
    function loginFR(){
        var  username  = "<%=usercode%>";  
        var  password  = "<%=userpwd%>"; 
        var  reporttype  = "<%=reporttype%>"; 
        var  reportcode  = "<%=reportcode%>"; 
        var scr = 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":password},
            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("单点登录出现失败");
            }
        });
        //var scr = document.getElementById("ifr_fr");   
        //scr.src = "url";
    } 
    
    </script>
    
    <style>  
          #ifr_fr{  
             84%;  
            height: 700px;  
          }  
    </style>  
    </head>
    <body onload="loginFR()">
    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>
    </html>

     

  • 相关阅读:
    React倒计时功能实现——解耦通用
    如何在 UmiJs 中配置使用 Sass
    Redux入门实战——todo-list2.0实现
    每天学点JavaScript基础(2)——JavaScript里的分号,你加还是不加?
    每天学点JavaScript基础(1)—— null 和 undefined
    CSS画图
    React入门实战实例——ToDoList实现
    博客园样式管理总结(个人博客园装修指南)
    如何使用VSCode发布博客到博客园
    React入门
  • 原文地址:https://www.cnblogs.com/lizm166/p/8006763.html
Copyright © 2020-2023  润新知