struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew Panetta (JIRA)" <>
Subject [jira] [Commented] (WW-4185) make default json date format configurable
Date Mon, 23 Dec 2013 05:13:50 GMT


Matthew Panetta commented on WW-4185:

I had a go at implementing this.

This commit will allow configuration of the date format used by the JSON plugin.

The default can be set for all actions by adding the following to struts.xml

<constant name="struts.json.dateformat" value="yyyy-MM-dd"/>

It can also get set for each action eg:
@Result(type = "json", params = {"defaultDateFormat", "MM-yyyy-dd"})
public class ProjectsAction extends ActionSupport {

> make default json date format configurable
> ------------------------------------------
>                 Key: WW-4185
>                 URL:
>             Project: Struts 2
>          Issue Type: New Feature
>          Components: Plugin - JSON
>    Affects Versions:
>            Reporter: Danny Schumacher
>            Priority: Minor
>              Labels: json, struts2
>             Fix For: 2.3.17
> Currently if no date format is specified using the @JSON annotation on a field the plugin
uses yyyy-MM-dd'T'HH:mm:ss. If someone wants all dates to be in a certain format they currently
have to add a @JSON(format="MM-dd-yyyy") annotation to each date fields. It would be nice
if there were some kind of configurable constant in struts such as
> <constant name="" value="MM-dd-yyyy" />
> to set the default date format.

This message was sent by Atlassian JIRA

View raw message