3

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)
bated
  • 919
  • 2
  • 15
  • 28
rand
  • 177
  • 2
  • 7
  • 15

2 Answers2

4

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" />
bated
  • 919
  • 2
  • 15
  • 28
-1

Send the request with Accept-Language Header

Got this error when trying to make request with java client. Browsers by default send the Accept-Language Header. So the client request should contain this header.

Accept-Language: en-GB
Sorter
  • 8,190
  • 5
  • 52
  • 63
  • In Oracle Commerce/ATG which this might not work as the locale might be based on the site you have chosen, rather than your browser header. – bated Jan 10 '18 at 21:28