Question

In struts the action scope was defined as

<action scope="session" .../>

How do you set the scope in Struts2?

Was it helpful?

Solution

There isn't really a direct equivalent in struts2. In struts1, that scope referred to the associated ActionForm.

Typically if you wanted to do something similar you'd create a session scoped bean either through spring, guice or struts2 configuration, and inject it into your action.

Or you could implement SessionAware, and manage the properties that you want to be session backed yourself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top