jspjstlatgoracle-commerce

javax.servlet.jsp.JspException: In <parseDate>, a parse locale can not be established


Does anyone can identify the root cause of this error? Using fmt:parseDate tag , to parse the date in correct format. I can't seem to find a way to replicate what causes this exception. MY date format is like for example:"2015-08-06 13:13:30.59" Pulling order.submittedDate value from DB and trying get dd from the date object.

<fmt:parseDate value="${order.submittedDate}" pattern="yyyy-MM-dd" var="formatedDate"/>
<fmt:formatDate pattern="dd" value="${formatedDate}" var="submittedDay"/>

find below the full stacktrace

    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)

Solution

  • Try the code below which will pass en_GB as the locale - you will need to replace this with your locale:

     <fmt:parseDate value="${order.submittedDate}" pattern="yyyy-MM-dd" var="formatedDate" parseLocale="en_GB" />
    

    If you want to soft code the locale you could do it as follows in 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" />