Question

In jsp I'm have this:

<h3>Order total: <fmt:formatNumber type="NUMBER" value="${order.total}"/></h3>

In html when open page:

<h3>Order total: <fmt:formatNumber value="20.0" type="NUMBER"/></h3>

But I'm don't see number, see only Order total:

full jsp:

<html xmlns:c="http://java.sun.com/jsp/jstl/core"
     xmlns:fn="http://java.sun.com/jsp/jstl/functions"
     xmlns:jsp="http://java.sun.com/JSP/Page"
     xmlns:spring="http://www.springframework.org/tags"
     xmlns:form="http://www.springframework.org/tags/form"
     xmlns:fmt="http://java.sun.com/jstl/format">

  <jsp:output omit-xml-declaration="yes"/>  
  <jsp:directive.page contentType="text/html;charset=UTF-8" />  

  <head><title>Spizza</title></head>
  <body>
    <h2>Your order</h2>

    <h3>Deliver to:</h3>
        <b>${order.customer.name}</b><br/>
        <b>${order.customer.address}</b><br/>
        <b>${order.customer.city}, ${order.customer.state} 
            ${order.customer.zipCode}</b><br/>
        <b>${order.customer.phoneNumber}</b><br/>
        <hr/>
        <h3>Order total: <fmt:formatNumber type="NUMBER" 
            value="${order.total}"/></h3>
        <hr/>
        <h3>Pizzas:</h3>

        <c:if test="${fn:length(order.pizzas) eq 0}">
        <b>No pizzas in this order.</b>
        </c:if>

        <br/>
        <c:forEach items="${order.pizzas}" var="pizza">
        <li>${pizza.size} : 
          <c:forEach items="${pizza.toppings}" var="topping">
            <c:out value="${topping}" />,
          </c:forEach>
        </li>
        </c:forEach>

    <form:form>
      <input type="hidden" name="_flowExecutionKey" 
             value="${flowExecutionKey}"/>
      <input type="submit" name="_eventId_createPizza" 
             value="Create Pizza" />
    <c:if test="${fn:length(order.pizzas) gt 0}">
      <input type="submit" name="_eventId_checkout" 
             value="Checkout" />
    </c:if>
      <input type="submit" name="_eventId_cancel" 
             value="Cancel" />
    </form:form>

    </body>
</html>
Was it helpful?

Solution

The documentation says:

Standard Syntax:

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

XML Syntax:

 <anyxmlelement xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top