如何在HTML中获取@Transient值

时间:2015-04-10 12:35:15

标签: java html spring hibernate annotations

我想从HTML获取@Transient值。我尝试过@ Basic,它在db中创建了条目。我需要得到这个值。

POJO的:

@Transient
private int  dueAmount;

public int getDueAmount() {
    return dueAmount =  this.getPaymentTotal() - this.getBillAmount() - this.getDiscountTotal();
}

public void setDueAmount(int dueAmount) {
    this.dueAmount = dueAmount;
}

控制器

@RequestMapping(value="/billByPatientId/{id}", method = RequestMethod.GET)  
public List<Bill> getBillsByPatientId(@PathVariable("id") String patientId)throws Exception { 

    List<Bill> BillDetailsByPatientId  = billService.getBillsByPatientId(patientId);

    for(Bill b : BillDetailsByPatientId){
        System.out.println(b.getDueAmount());
    }
    return billService.getBillsByPatientId(patientId);
}

的js

$http.get('/bill/billByPatientId/'+patientData.id)
.success(function (data, status, headers, config) {
    console.log(data)
    $scope.bills = data;
});

HTML

 <table data-ng-show='bills.length > 0' class="table table-hover"> 
        <thead>
            <tr>
                <th class="col-lg-1 text-center">Bill No</th>
                <th class="col-lg-3 text-center">Status</th>
            </tr>
</thead>
<tr data-ng-repeat="bill in bills">
    <td class="text-center">{{bill.billNo}}</td>
    <td class="text-right">{{bill.dueAmount}}</td>
</tr>

在我目前的代码中,我得到了#34; dueAmount&#34;由于印刷的价值&#34; dueAmount&#34;在我的控制器中,否则值将为空。

怎么做?

我推荐人this文件

0 个答案:

没有答案