Re: Problem reading a resource file (migrating 2.3.29 --> 2.5.10)

2017-03-10 Thread Lukasz Lenart
2017-03-11 0:21 GMT+01:00 Heikki Hyyrö :
> Hi,
>
> I decided to migrate a Struts-based application from Struts 2.3.x to 2.5.x.
> The application worked without problems with Struts version 2.3.29. After
> updating to 2.5.10, the application no longer seems to be able to read a
> root-level resource file "package.properties": calling
> getText("some.needed.property") results in an exception.
>
> Since this problem did not happen with 2.3.29, I wonder if the 2.5.x
> versions have introduced a fundamental change in how the resource files are
> handled? I was not able to find such information in the 2.3 --> 2.5
> migration guide.
>
> The problem occurs in the constructor of a database connection manager class
> that tries to retrieve database information (driver information, database
> url, and so on) from package.properties. A rough sketch of the class is
> something like:
>
> public class DbConnectionManager extends ActionSupport
> {
>   private DbConnectionManager()
>   {
> String driverNames = getText("database.drivers");  // This throws an
> exception in 2.5.10, but was ok in 2.3.29.
> ...
>   }
> }
>
> I suppose this problem could have something to do with the fact that this is
> a singleton class that is initialized only once during the lifetime of the
> application? If this is the case, then what would a simple way to fix the
> problem? A related question would be: how should I access resource files
> from a non-action context (e.g. read resources in static initialization), if
> ActionSupport no longer permits it?

This is do the changes in ActionSupport's dependencies, you must
inject them first to have access to resource bundles.

Instead your approach with singleton you can use something like this

public class DbConnectionManager {

  public DbConnectionManager(@Inject TextProvider textProvider) {
String driverNames = textProvider.getText("database.drivers");
...
  }
}

and then

public class MyAction extends ActionSupport {

  public String execute() {
DbConnectionManager mgr = container.inject(DbConnectionManager.class)

  }
}

but perhaps the best option would be to disconnect your DAO layer from
Web layer, you have coupled two different layers which is a "bad
design" ™


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

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



Re: Struts 1.x and Strtus2.x With Tiles 2.x

2017-03-10 Thread Lukasz Lenart
2017-03-10 20:46 GMT+01:00 Kokkodan Venu :
> Hi, Can you pls let me know how you have migrated your old project with 
> Struts1 and Tiles 2? I have a same situation here where I need to keep struts 
> 1.

The best option will be to keep both Struts 1 based app with Struts 2
based app next to it and rewriting action by action to Struts 2.


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

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



RE: Struts 1.x and Strtus2.x With Tiles 2.x

2017-03-10 Thread Kokkodan Venu
Hi, Can you pls let me know how you have migrated your old project with Struts1 
and Tiles 2? I have a same situation here where I need to keep struts 1.

Pls respond as quick as possible.

Thank You
Venugopalan


This e-mail, including any attachments, may constitute a Federal record or 
other Government property that is intended only for the addressed individuals. 
This message may also contain information that is sensitive, confidential, or 
otherwise protected from disclosure under applicable law. If you are not a 
named addressee you must not disseminate, distribute or copy this e-mail. If 
you have received this e-mail in error, please notify the sender immediately 
and delete this e-mail from your system.


Problem reading a resource file (migrating 2.3.29 --> 2.5.10)

2017-03-10 Thread Heikki Hyyrö

Hi,

I decided to migrate a Struts-based application from Struts 2.3.x to 
2.5.x. The application worked without problems with Struts version 
2.3.29. After updating to 2.5.10, the application no longer seems to be 
able to read a root-level resource file "package.properties": calling 
getText("some.needed.property") results in an exception.


Since this problem did not happen with 2.3.29, I wonder if the 2.5.x 
versions have introduced a fundamental change in how the resource files 
are handled? I was not able to find such information in the 2.3 --> 2.5 
migration guide.


The problem occurs in the constructor of a database connection manager 
class that tries to retrieve database information (driver information, 
database url, and so on) from package.properties. A rough sketch of the 
class is something like:


public class DbConnectionManager extends ActionSupport
{
  private DbConnectionManager()
  {
String driverNames = getText("database.drivers");  // This throws 
an exception in 2.5.10, but was ok in 2.3.29.

...
  }
}

I suppose this problem could have something to do with the fact that 
this is a singleton class that is initialized only once during the 
lifetime of the application? If this is the case, then what would a 
simple way to fix the problem? A related question would be: how should I 
access resource files from a non-action context (e.g. read resources in 
static initialization), if ActionSupport no longer permits it?


-Heikki


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



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

2017-03-10 Thread Vishal Jhagadiawala
Hi Dave,
it was working find from earlier version, here is the discussion thread from 
coderanch. formatDate & i18nInteceptor 
(Struts forum at Coderanch)

  
|  
|   
|   
|   ||

   |

  |
|  
|   |  
 formatDate & i18nInt...
 In my tiles to display the date on the header of each page I am using 
>
> 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: davelnew...@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton 
b: Bucky Bits 
g: davelnewton 
so: Dave Newton 


   

[ANN] Apache Struts 2.3.32 GA with Security Fixe Release

2017-03-10 Thread Lukasz Lenart
The Apache Struts group is pleased to announce that Struts 2.3.32 is
available as a “General Availability” release. The GA designation is
our highest quality grade.

This release addresses one potential security vulnerability:
- Possible Remote Code Execution when performing file upload based on
Jakarta Multipart parser - S2-045 -
http://struts.apache.org/docs/s2-045.html

Apache Struts 2 is an elegant, extensible framework for creating
enterprise-ready Java web applications. The framework is designed to
streamline the full development cycle, from building, to deploying, to
maintaining applications over time.

All developers are strongly advised to perform this action.

The 2.3.x series of the Apache Struts framework has a minimum
requirement of the following specification versions: Servlet API 2.4,
JSP API 2.0, and Java 6.

Should any issues arise with your use of any version of the Struts
framework, please post your comments to the user list, and, if
appropriate, file a tracking ticket.

You can download this version from our download page.
http://struts.apache.org/download.cgi#struts-23x


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

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



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

2017-03-10 Thread Dave Newton
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_...@yahoo.com.invalid> wrote:

> Hi,I am having issue with following date tag, after upgrading to struts
> 2.3.30
> 
>
> 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: davelnew...@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton 
b: Bucky Bits 
g: davelnewton 
so: Dave Newton 


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

2017-03-10 Thread Lukasz Lenart
2017-03-10 16:59 GMT+01:00 Vishal Jhagadiawala :
> Hi,I am having issue with following date tag, after upgrading to struts 2.3.30
> 
>
> 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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



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

2017-03-10 Thread Vishal Jhagadiawala
Hi,I am having issue with following date tag, after upgrading to struts 2.3.30


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