ajax调用后台并返回页面进行操作

JSP 部分:

<script type="text/javascript">
 $(document).ready(function(){
  <% if("2008112800008619".equals(deptCode)){ %>
   initMysolution(); //得到My solution的任务数
  <%}%>
  <%if("1".equals(popedom)){%>
   initNoBid();//得到No Bid的任务数
  <%}%>
  $("#monthTree").youiTree();
  $("#monthTree").show();
 });
 //得到My solution的任务数
 function initMysolution(){
   var url="<%=path%>/order/orderListAction.do?method=findMySolutionCount";//caomeng:2011-10-10     
     var xmlHttp;
     var str="order_type_cd='50030002'&stage_id=STAGE0012";
     try{
      xmlHttp=new XMLHttpRequest();
     }catch(e){
      try{
       xmlHttp=new ActiveXObject("Msxml2.XMLHTTP")
      }catch(e){
       xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
     }
     xmlHttp.open("post",url,true);
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
     xmlHttp.send(str);
     xmlHttp.onreadystatechange=function(){
      if(xmlHttp.readyState==4){
       if(xmlHttp.status==200){           
           var retu=xmlHttp.responseText;
            document.getElementById( "mysol" ).innerHTML =retu;    
       }
      }
     }
  }
  
  //得到No Bid的任务数
 function initNoBid(){
   var url="<%=path%>/order/orderListAction.do?method=findNoBidCount";//caomeng:2011-10-10     
     var xmlHttp;
     var str="order_type_cd='50030002'&stage_id=STAGE0012";
     try{
      xmlHttp=new XMLHttpRequest();
     }catch(e){
      try{
       xmlHttp=new ActiveXObject("Msxml2.XMLHTTP")
      }catch(e){
       xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
     }
     xmlHttp.open("post",url,true);
     xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
     xmlHttp.send(str);
     xmlHttp.onreadystatechange=function(){
      if(xmlHttp.readyState==4){
       if(xmlHttp.status==200){           
           var retu=xmlHttp.responseText;
            document.getElementById( "nobidcount" ).innerHTML =retu;    
       }
      }
     }
  }
</script>

 

 

 

Struts1 : CustOrderListAction.java 部分:

 

/**
	 * 查询My Solution任务数
	 * add by caomeng bug0001957
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return 
	 */
	public ActionForward findNoBidCount(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){
		PrintWriter out=null;
		try {
            out=response.getWriter();
        } catch (IOException e) {
            e.printStackTrace();
        }
        OrderListBean orderListBean = (OrderListBean) form ;
		User userInfo = this.getUserInfo(request);
		String order_type_cd = orderListBean.getOrder_type_cd();
		String val = custOrderListService.findNoBidCount(orderListBean, userInfo);
		//System.out.println("val:"+val);
		out.print(val);
		return null;
	}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值