aspose file tools*
The moose likes Struts and the fly likes Struts2 Scope Interceptor - newbie Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 Scope Interceptor - newbie" Watch "Struts2 Scope Interceptor - newbie" New topic

Struts2 Scope Interceptor - newbie

John Dolezal

Joined: Jun 07, 2013
Posts: 1
Hello there,
im new to the forum and also new to Struts2.
I am trying to implement Scope Interceptor, let me explain my app.

I want to store user information from DB into session from login window, so i can validate logged user across application.

I have AppUser.class (which is my model class)

I have this struts.xml , where Login page will go to the loginServiceAction.class where i need to Scope Inteceptor to be used and store (after returning response) my property/model "AppUser" into session.



Problem is:
Scope interceptor will not store anything into session and will not get that/nothing from it.
Is there some error in my code ?

Thank you
Jaames Smith

Joined: May 28, 2013
Posts: 9
I did not read all your codes but it looks like you are trying to use a new AppUser object in your loginServiceAction class to check if user is logged in. This will not work since it is initialized to default values. You need to do:

I agree. Here's the link:
subject: Struts2 Scope Interceptor - newbie
Similar Threads
Post-Redirect-Get pattern with Struts 2 ModelDriven action?
Struts 2 + Spring + Interceptors + Bean Null
Scope interceptor: scope.type = end not doing any cleanup.
Records are not being saved
Struts: how to return to previous page after login