超链接跳转 打开一个新的页面

来源:互联网 发布:软件价值评估 编辑:程序博客网 时间:2024/05/16 08:35

第一种方法

jsp页面

<aclass="" style="" id="downloadHistory"href="">下载列表</a>


js实现方法

 $('#downloadHistory').click(function() {  var referralName1=$("input[name=referralName1]").val(); var uid1=$("input[name=uid1]").val();  var href='reward/download?referralName='+ referralName1+'&'+'uid='+uid1; $(this).prop('href', href); });


EJB  

@GET

@Path("/download")

@Produces(MediaType.APPLICATION_JSON)

publicResponsedownload(@QueryParam("uid")Stringuid,

@QueryParam("referralName")StringreferralName)throwsIOException {



第二种方法  大力推荐:跳转时打开一个新的页面,原有页面不动

//JSP

<a   href=""   id="xxxx"   target="_blank"    style="text-decoration:underline;">拆分预览</a>


//JS

function divide(){
    
    $("#xxxx").click(function(e){
      var productTitle = $('input[name=productTitle]').val(); //名称
      var totalAmount = $('input[name=totalAmount]').val();  //金额
      var perAmount = $('input[name=perAmount]').val(); //  每期金额
      var method = $('#method option:selected').val();//还款方式
      var rate = $('input[name=expectYearRate]').val(); //预期年化收益率
      if(productTitle===""){
        document.getElementById("productTitle").focus();
        return false;
      }
     if(totalAmount===""){
        document.getElementById("totalAmount").focus();
        return false;
     }
     if(perAmount===""){
        document.getElementById("perAmount").focus();
        return false;
     }
    if(method===""){
        document.getElementById("method").focus();
        return false;
    }
    if(rate===""){
        document.getElementById("expectYearRate").focus();
        return false;
    }


    $("#xxxx").attr('href','feibiao/nonBidFinanceSplit/'+productTitle+'/'+totalAmount+'/'+perAmount+'/'+method+'/'+rate);
 });  
}


//EJB

@GET
@Path("/nonBidFinanceSplit/{title}/{totalAmount}/{perAmount}/{method}/{rate}")

    public Response nonBidFinanceSplit(

                                       @PathParam("title") String title,

                                       @PathParam("rate") double rate,
                                       @PathParam("method") String method ,
                                       @PathParam("totalAmount") double totalAmount,
                                       @PathParam("perAmount") int perAmount){

        List<Loan> result = 数据获取;

      
       return forward("/loan/request/feibiaoDivideList", ImmutableMap.of("splitedLoans", result));
    }



1 0
原创粉丝点击