You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vishal Jhagadiawala <vi...@yahoo.com.INVALID> on 2017/03/10 15:59:47 UTC

issue with getting current date using date tag in latest struts 2.3.3X

Hi,I am having issue with following date tag, after upgrading to struts 2.3.30
<s:date name="%{new java.util.Date()}" format="yyyy-MM-dd" />

it shows no value in the UI page. 
Question: was there usage of OGNL expression changed in latest version of struts2. eg. 2.3.30,  the above usage works without issue in Struts2 2.2.1
any help would be appreciated.

Regards,
Vishal

Re: issue with getting current date using date tag in latest struts 2.3.3X

Posted by Christoph Nenning <Ch...@lex-com.net>.
The security mechanism mentioned by Lukasz was added in mid 2014. Before 
that it was possible to use new in OGNL expressions.

Regards,
Christoph



Vishal Jhagadiawala <vi...@yahoo.com.INVALID> schrieb am 11.03.2017 
00:16:03:

> From: Vishal Jhagadiawala <vi...@yahoo.com.INVALID>
> To: Struts Users Mailing List <us...@struts.apache.org>, 
> Date: 11.03.2017 00:21
> Subject: Re: issue with getting current date using date tag in 
> latest struts 2.3.3X
> 
> Hi Dave,
> it was working find from earlier version, here is the discussion 
> thread from coderanch.<s:date name=%{new java.util.Date()} /> 
> formatDate & i18nInteceptor (Struts forum at Coderanch)
> 
> 
> | 
> | 
> | 
> |   |    |
> 
>    |
> 
>   |
> | 
> |   | 
> <s:date name=%{new java.util.Date()} /> formatDate & i18nInt...
>  In my tiles to display the date on the header of each page I am 
> using <s:date name="%{new java.util...  |   |
> 
>   |
> 
>   |
> 
> 
> 
> Regards,
> Vishal 
> 
>     On Friday, 10 March 2017, 11:19, Dave Newton 
> <da...@gmail.com> wrote:
> 
> 
>  I'm surprised that worked, since it's supposed to be the name of the 
date
> property you want to display. Maybe it was introspecting to see if it 
was
> an immediate date value, but that's deceptive and counter-intuitive.
> 
> In any case, that's a large version jump. OGNL was updated multiple 
times.
> If I were guessing (which I am; sorry) I'd say it's related to the
> evaluation of parameter names in OGNL.
> 
> Unrelated, but making this work correctly seems like a win.
> 
> Dave
> 
> 
> On Fri, Mar 10, 2017 at 10:59 AM, Vishal Jhagadiawala <
> vish_212@yahoo.com.invalid> wrote:
> 
> > Hi,I am having issue with following date tag, after upgrading to 
struts
> > 2.3.30
> > <s:date name="%{new java.util.Date()}" format="yyyy-MM-dd" />
> >
> > it shows no value in the UI page.
> > Question: was there usage of OGNL expression changed in latest version 
of
> > struts2. eg. 2.3.30,  the above usage works without issue in Struts2 
2.2.1
> > any help would be appreciated.
> >
> > Regards,
> > Vishal
> 
> 
> 
> 
> -- 
> e: davelnewton@gmail.com
> m: 908-380-8699
> s: davelnewton_skype
> t: @dave_newton <https://twitter.com/dave_newton>
> b: Bucky Bits <http://buckybits.blogspot.com/>
> g: davelnewton <https://github.com/davelnewton>
> so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>
> 
> 
> 

This Email was scanned by Sophos Anti Virus

Re: issue with getting current date using date tag in latest struts 2.3.3X

Posted by Vishal Jhagadiawala <vi...@yahoo.com.INVALID>.
Hi Dave,
it was working find from earlier version, here is the discussion thread from coderanch.<s:date name=%{new java.util.Date()} /> formatDate & i18nInteceptor (Struts forum at Coderanch)

  
|  
|   
|   
|   |    |

   |

  |
|  
|   |  
<s:date name=%{new java.util.Date()} /> formatDate & i18nInt...
 In my tiles to display the date on the header of each page I am using <s:date name="%{new java.util...  |   |

  |

  |

 

Regards,
Vishal 

    On Friday, 10 March 2017, 11:19, Dave Newton <da...@gmail.com> wrote:
 

 I'm surprised that worked, since it's supposed to be the name of the date
property you want to display. Maybe it was introspecting to see if it was
an immediate date value, but that's deceptive and counter-intuitive.

In any case, that's a large version jump. OGNL was updated multiple times.
If I were guessing (which I am; sorry) I'd say it's related to the
evaluation of parameter names in OGNL.

Unrelated, but making this work correctly seems like a win.

Dave


On Fri, Mar 10, 2017 at 10:59 AM, Vishal Jhagadiawala <
vish_212@yahoo.com.invalid> wrote:

> Hi,I am having issue with following date tag, after upgrading to struts
> 2.3.30
> <s:date name="%{new java.util.Date()}" format="yyyy-MM-dd" />
>
> it shows no value in the UI page.
> Question: was there usage of OGNL expression changed in latest version of
> struts2. eg. 2.3.30,  the above usage works without issue in Struts2 2.2.1
> any help would be appreciated.
>
> Regards,
> Vishal




-- 
e: davelnewton@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton <https://twitter.com/dave_newton>
b: Bucky Bits <http://buckybits.blogspot.com/>
g: davelnewton <https://github.com/davelnewton>
so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>


   

Re: issue with getting current date using date tag in latest struts 2.3.3X

Posted by Dave Newton <da...@gmail.com>.
I'm surprised that worked, since it's supposed to be the name of the date
property you want to display. Maybe it was introspecting to see if it was
an immediate date value, but that's deceptive and counter-intuitive.

In any case, that's a large version jump. OGNL was updated multiple times.
If I were guessing (which I am; sorry) I'd say it's related to the
evaluation of parameter names in OGNL.

Unrelated, but making this work correctly seems like a win.

Dave


On Fri, Mar 10, 2017 at 10:59 AM, Vishal Jhagadiawala <
vish_212@yahoo.com.invalid> wrote:

> Hi,I am having issue with following date tag, after upgrading to struts
> 2.3.30
> <s:date name="%{new java.util.Date()}" format="yyyy-MM-dd" />
>
> it shows no value in the UI page.
> Question: was there usage of OGNL expression changed in latest version of
> struts2. eg. 2.3.30,  the above usage works without issue in Struts2 2.2.1
> any help would be appreciated.
>
> Regards,
> Vishal




-- 
e: davelnewton@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton <https://twitter.com/dave_newton>
b: Bucky Bits <http://buckybits.blogspot.com/>
g: davelnewton <https://github.com/davelnewton>
so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>

Re: issue with getting current date using date tag in latest struts 2.3.3X

Posted by Lukasz Lenart <lu...@apache.org>.
2017-03-10 16:59 GMT+01:00 Vishal Jhagadiawala <vi...@yahoo.com.invalid>:
> Hi,I am having issue with following date tag, after upgrading to struts 2.3.30
> <s:date name="%{new java.util.Date()}" format="yyyy-MM-dd" />
>
> it shows no value in the UI page.
> Question: was there usage of OGNL expression changed in latest version of struts2. eg. 2.3.30,  the above usage works without issue in Struts2 2.2.1
> any help would be appreciated.

Yes, you should see an error message in the logs, using "new" in
expressions is not allowed.
http://struts.apache.org/docs/security.html#Security-Internalsecuritymechanism


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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