Thanks Dave.

After reading your email I tried your solution, outputting the date in the tag 
body rather than using the value attribute. I was surprised to find the 
<s:param> tag behaves the way it does with Date objects, invoking toString(). 
Given the behavior of the Date type conversion class, I assumed param would 
output Date values in a compatible date format.

Many thanks,

Scott 

--- On Fri, 4/13/12, Dave Newton <davelnew...@gmail.com> wrote:

> From: Dave Newton <davelnew...@gmail.com>
> Subject: Re: Behavior of <s:param> tags with date values
> To: "Struts Users Mailing List" <user@struts.apache.org>
> Date: Friday, April 13, 2012, 1:05 PM
> I'd think it'd just use the default
> toString(), but I could be (badly)
> mistaken.
> 
> IMO you'd want to format it in the body of a wrapping
> <s:param> tag.
> 
> Dave
> 
> On Fri, Apr 13, 2012 at 12:50 PM, Scott Williams
> <scottfwilli...@yahoo.com>wrote:
> 
> > Hi:
> >
> > I am experiencing some unexpected behavior with the
> Struts2 <s:param> tag
> > when using it with date values. When I try to use an
> <s:param> tag within
> > <s:url> to pass a date argument, the date is not
> output in the
> > DateFormat.SHORT format, resulting in a type conversion
> error on submission.
> >
> > For example, these  struts tags:
> >
> > <s:url id="anchorUrl" namespace="/experiment"
> action="go" escapeAmp="true">
> >  <s:param name="inDate" value="inDate"/>
> > </s:url>
> > <s:a href="%{anchorUrl}" id="go">Click this
> here...</s:a>
> >
> > produce this output:
> >
> > <a id="go"
> >
> href="/EXP/experiment/go.action?inDate=Thu+Apr+12+21%3A52%3A30+EDT+2012">Click
> > this here...</a>
> >
> > With HTML escaping removed, the result is "Fri Apr 13
> 12:31:00 EDT 2012",
> > a format that nests the time inside the date.
> >
> > Unsurprisingly, this is causing a type conversion error
> when submitted to
> > the Action class. I'm perplexed -- could I be
> misunderstanding the tags'
> > usage, and this the expected behavior? Or might this be
> a bug, perhaps?
> >
> > Many thanks,
> >
> > Scott Williams
> >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to