javax.servlet.jsp.JspException:在 <parseDate> 中,无法建立解析语言环境

ran*_*and 4 jsp jstl atg oracle-commerce

有谁能确定此错误的根本原因吗?使用 fmt:parseDate tag ,以正确的格式解析日期。我似乎无法找到一种方法来复制导致此异常的原因。我的日期格式类似于:“2015-08-06 13:13:30.59”从数据库中提取 order.subscribedDate 值并尝试从日期对象中获取 dd 。

<fmt:parseDate value="${order.submittedDate}" pattern="yyyy-MM-dd" var="formatedDate"/>
<fmt:formatDate pattern="dd" value="${formatedDate}" var="submittedDay"/>
Run Code Online (Sandbox Code Playgroud)

在完整的堆栈跟踪下面找到

    javax.servlet.jsp.JspException: In &lt;parseDate&gt;, a parse locale can not be established
at org.apache.taglibs.standard.tag.common.fmt.ParseDateSupport.doEndTag(ParseDateSupport.java:138)
at org.apache.jsp.tp_002dapp.emailTemplate.orderConfirmationEmail_jsp._jspx_meth_fmt_005fparseDate_005f0(orderConfirmationEmail_jsp.java:1323)
Run Code Online (Sandbox Code Playgroud)

bat*_*ted 5

尝试下面的代码,它将传递 en_GB 作为区域设置 - 您需要将其替换为您的区域设置:

 <fmt:parseDate value="${order.submittedDate}" pattern="yyyy-MM-dd" var="formatedDate" parseLocale="en_GB" />
Run Code Online (Sandbox Code Playgroud)

如果您想对区域设置进行软编码,您可以在 ATG 中按如下方式进行:

<dsp:importbean var="requestLocale" bean="/atg/dynamo/servlet/RequestLocale" />
<fmt:setLocale value="${requestLocale.locale}"/>
<fmt:parseDate value="${order.submittedDate}" pattern="yyyy-MM-dd" var="formatedDate" />
Run Code Online (Sandbox Code Playgroud)