Java JSTL formatNumber显示空字符串
在jsp中,我有以下内容:Java JSTL formatNumber显示空字符串,java,spring,jsp,jstl,Java,Spring,Jsp,Jstl,在jsp中,我有以下内容: <h3>Order total: <fmt:formatNumber type="NUMBER" value="${order.total}"/></h3> 说: 标准语法: XML语法: 是否在html中显示?是的,当在浏览器中打开源代码时。嗯……如果是JSP,则不应出现这种情况。您尝试访问的URL是什么,以及您的控制器servlet是如何配置的 <h3>Order total: <fmt:formatN
<h3>Order total: <fmt:formatNumber type="NUMBER" value="${order.total}"/></h3>
说:
标准语法:
XML语法:
是否在html中显示
?是的,当在浏览器中打开源代码时。嗯……如果是JSP,则不应出现这种情况。您尝试访问的URL是什么,以及您的控制器servlet是如何配置的
<h3>Order total: <fmt:formatNumber value="20.0" type="NUMBER"/></h3>
<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>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<anyxmlelement xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" />