我将jsp中的值作为不同的值而不是我输入

时间:2014-12-30 04:11:07

标签: java javascript jsp

我在jsp中获得的值为2.2222222E7。但我给了输入22222222.如何解决? AM使用双数据类型。请给我你的建议来解决我的问题。我可以使用javascript解决?我怎么样?

jsp页面:

    <table id="payout" class="display" style="float:left; width: 100%;border-radius:  
       5px 5px 5px 5px;
                box-shadow: 2px 2px 6px #666666;-moz-box-sizing: none;" border=1  
           data="${payout}">

                    <thead style="color: red">
         <tr>
                    <td class="heading">Charge</td>
                    <td class="heading">Cost Before Discount</td>
                    <td class="heading">After Plan Discount</td>
                    <td class="heading">After Booking Discount</td>


             </tr> 
        </thead>
        <tbody>
      <c:forEach items="${payouts}" var="payout" varStatus="row">
                <tr>
                     <td >Base Cost</td> 
                     <td>${payout.baseCost.costBeforeDiscount}</td>
                     <td>${payout.baseCost.afterPlanDiscount}</td>
                     <td>${payout.baseCost.afterBookingDiscount}</td>

                </tr>
       </tbody>

        </table>
                                </div>
                            </div>
                         </div>

1 个答案:

答案 0 :(得分:2)

您可以在td标记中使用数字格式

        <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

                            <table id="payout" class="display" style="float:left; width: 100%;border-radius: 
                 5px 5px 5px 5px;
                        box-shadow: 2px 2px 6px #666666;-moz-box-sizing: none;" border=1  data="${payout}">

                            <thead style="color: red">

                      <tr>
                            <td class="heading">Charge</td>
                            <td class="heading">Cost Before Discount</td>
                            <td class="heading">After Plan Discount</td>
                            <td class="heading">After Booking Discount</td>


                     </tr> 
                </thead>
                <tbody>
        <c:forEach items="${payouts}" var="payout" varStatus="row">
                        <tr>
                             <td >Base Cost</td> 
                             <c:set var="basecost" value="payout.baseCost.costBeforeDiscount" />
                            <td><fmt:formatNumber pattern="########.####"   
          value="${payout.baseCost.costBeforeDiscount}"/></td>
                             <c:set var="basecost" value="payout.baseCost.afterPlanDiscount" />
                             <td><fmt:formatNumber pattern="########.####" 
           value="${payout.baseCost.afterPlanDiscount}"/></td>
                            <c:set var="basecost" value="payout.baseCost.afterBookingDiscount" />
                             <td><fmt:formatNumber pattern="########.####" 
           value="${payout.baseCost.afterBookingDiscount}"/></td>

                        </tr>

                    </c:forEach>
                </tbody>
                </table>