This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts 2 + Spring + Interceptors + Bean Null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 + Spring + Interceptors + Bean Null" Watch "Struts 2 + Spring + Interceptors + Bean Null" New topic
Author

Struts 2 + Spring + Interceptors + Bean Null

Jacques Mivi
Greenhorn

Joined: Nov 24, 2011
Posts: 7
Hi,

Small problem that I struggled for several days. I use frameworks Spring 3 + Hibernate + Struts 2.

I have a login action. I inject a bean via Spring and it works fine. Now I try to create an interceptor to separate the input validation and the action. But the intercetpor c'ant access to a bean.


An abstract of the interceptor



I updated applicationContext.xml as follows:


And finally I inject in struts.xml


And unfortunately I have always the following error



The strangest thing is when I do all the processing in the action (without interceptor) everything works good.

If you have an idea I'm interested.

Thank you & Have a nice day

Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

When you are calling that object from database? How you are doing that?


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Jacques Mivi
Greenhorn

Joined: Nov 24, 2011
Posts: 7
When you are calling that object from database? How you are doing that?


Hello,

My jsp - Account bar


My struts.xml


An abstract of the Action


And myapplicationContext.xml


With this way everything works good accountBean can be use with the jsp data.
Jacques Mivi
Greenhorn

Joined: Nov 24, 2011
Posts: 7
When I try to change the interceptor in action. AccountBean can be use.

For exemple the interceptor


and struts.xml


Display what i record in the jsp.

The interceptors method intercept(ActionInvocation invocation) seems to disturb spring.
Jacques Mivi
Greenhorn

Joined: Nov 24, 2011
Posts: 7
I'm progressing slowly.

It's seems that the bean "accountBean" it's different beetween the class action and class interceptor. The bean created with my accountbar.jsp is used to create the class action but not my interceptor.

I try to change the scope without success.
Jacques Mivi
Greenhorn

Joined: Nov 24, 2011
Posts: 7
Still no solution, Any idea?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 2 + Spring + Interceptors + Bean Null
 
Similar Threads
Struts2.0 interceptor Problem
struts2 problem
Authentication Problem
Struts 2 Fileupload problem
Interceptor messes up action class in Struts2