Tag datetimepicker gives "Invalid field value for field xxx:" on form submit
when browser locale does not match request_locale
------------------------------------------------------------------------------------------------------------------------------
Key: WW-1917
URL: https://issues.apache.org/struts/browse/WW-1917
Project: Struts 2
Issue Type: Bug
Environment: Linux, JDK 1.6.0, Tomcat 5.5.17, Struts 2.0.6, Eclipse
3.2 Callisto, Firefox 1.5
Reporter: Torsten Römer
Assigned To: Musachy Barroso
- Deploy struts2-blank-2.0.6
- Create /example/Datepicker.jsp:
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:head theme="ajax"/>
<s:form action="Datepicker">
<s:datetimepicker label="datepicker" name="datepicker"/>
<s:submit/>
</s:form>
Locale: <s:text name="%{locale}"/>
- Create example.Datepicker.java:
package example;
import java.util.Date;
public class Datepicker extends ExampleSupport {
private Date datepicker;
public String execute() throws Exception {
return SUCCESS;
}
public Date getDatepicker() {
return datepicker;
}
public void setDatepicker(Date datepicker) {
this.datepicker = datepicker;
}
}
- Add action Datepicker to example.xml:
<action name="Datepicker" class="example.Datepicker">
<result name="input">/example/Datepicker.jsp</result>
<result name="success">/example/Datepicker.jsp</result>
</action>
- Rebuild/restart the example app
- (Linux) Open a console and check/set the LANG variable. Example:
LANG=de_DE.UTF-8
- Start Firefox from the console
- Go to the URL http://localhost:8080/struts2-blank-2.0.6/example/Datepicker.jsp
- Pick some date, the format is dd.MM.yy (this is the correct format for German
locale)
- Submit the form: No error
- Add request_locale=en_US to the URL:
http://localhost:8080/struts2-blank-2.0.6/example/Datepicker.action?request_locale=en_US
- Pick some date, the format is still dd.MM.yy (while I think it should be US
locale now)
- Submit the form: There is an error: Invalid field value for field
"datepicker", and the redisplayed date is NaN.NaN.aN
- When changing the request_locale back to de_DE, there are no more errors
- When adding the attribute displayFormat="yyyy-MM-dd" to the tag, the form
subission always fails with the above error, even if request_locale=de_DE
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.