birt报表从session中取参数

 自从注册CSDN没写过一篇文章,今天闲来没事,整理点小东西,写下来。

birt从session中取从JSP传递的参数。

1、把JSP页面获得的参数放到session中,以下是简短代码:

 

<body>
   <table>
       <input type="text" id="name" />
       <input type="text" id="age"/>
       <input type="text" id="sex"/>
       <input  type="button" οnclick="subAajax()" />
   </table>
   <iframe name="reportIframe" id="reportIframe" height="82%" 
   style="width: 100%;z-index:9999;background: url(../images/public/8.gif);"frameborder="0"  scrolling="auto" οnlοad="change();">
   </iframe>
</body>
<script type="text/javascript">
   function subAajax(){
        var name=document.getElementById("name");
        var age=document.getElementById("age");
        var sex=document.getElementById("sex");
         var reportIframe = document.getElementById("reportIframe");
       var url1="<%= request.getContextPath()%>" + "/frameset?__report=/report/"+reportName+"&__toolbar=false";
       var con="&name="+name+"&age="+age+"&sex="+sex;
       $.ajax({
             url:"<%= request.getContextPath()%>" +"/processRptdesign.do?method=addPosearchParam"+con, //处理页面
             type:"post",
             dataType:"html",
             success:function(msg){
               
               $("#reportIframe").attr("src",encodeURI(url1));
             }
           });
      
   }
   
</script>
public class ProcessParamAction extends DispatchAction {
	public ActionForward addPosearchParam(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		  	
		Map<String, String> map=new HashMap<String, String>();
	
		String name=request.getParameter("name");
		String age=request.getParameter("age");
		String sex=request.getParameter("sex");
				map.put("stime",stime);
		map.put("name",name);
		map.put("age",age);
		map.put("sex",sex);			
		request.getSession().setAttribute( "AppContextKey","numberWhere");
		request.getSession().setAttribute("AppContextValue", map);
				

		return null;
		
	}



2、在报表中取session中的数据,在before open中写如下代码获取:

var name=numberWhere.get("name");
var age=numberWhere.get("age");
var sex=numberWhere.get("sex");


以上仅供参考,欢迎大家指正,共同学习

  

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值