wood burning stoves 2.0*
The moose likes Struts and the fly likes action scope in struts 2 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 "action scope in struts 2" Watch "action scope in struts 2" New topic
Author

action scope in struts 2

Asha Ramprasad
Greenhorn

Joined: Mar 10, 2012
Posts: 11
I am preparing for an interview.
For some days i am browsing to answer the following questions

What is action scope and how is it different from request scope ?

How can two interceptors in a stack communicate or If you were to pass some value from one interceptor to another, by using this value the next interceptor executes some specific statements, how would you do it ?

Please post your answer if you know about it.
Its important.

Thanks and regards,
P.Asha
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

What is action scope and how is it different from request scope ?


I didn't understand what do you mean by action scope i haven't heard of it. Request scope do you mean request object.

Interceptors follows command patterns they will executes one by one how we are configured it in interceptor-stack. Just consider fileUpload interceptor It is responsible for uploading the file.



Using that wrapper they are getting fileName, contentType, etc.,

If you were to pass some value from one interceptor to another, by using this value the next interceptor executes some specific statements, how would you do it ?


We do not pass data one interceptor to another and never acrossed such scenario each and every interceptor work independently. Those are like(filters in servlets) gate keepers before reaching your action class even they can decide whether the request is going to hit action class or not.

All the best.

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.
Asha Ramprasad
Greenhorn

Joined: Mar 10, 2012
Posts: 11
Thanks for your reply.

While thinking about scope i too thought that there are only four scopes application , request , session and page.

But seeing the below link i just confused and cant differenciate action scope and request scope.
http://struts.apache.org/2.1.8/docs/set.html

I think you can easily understand. If so please explain me .

And thanks for the answer for interceptors.
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

It is useful when you wish to assign a variable to a complex expression and then simply reference that variable each time rather than the complex expression. Usually we donot set to any scope means(in practical we don't set it to any scope) but you can do it.

Asha Ramprasad
Greenhorn

Joined: Mar 10, 2012
Posts: 11
Thank you so much.

Now i understand.
Bhanuprasad saketi
Greenhorn

Joined: Aug 15, 2012
Posts: 8
Hello everybody

I am working with struts2 but i am new for struts2

in my application i want to send the data from one Interceptor to another Interceptor

how can i send the data?


any one please help me
 
jQuery in Action, 2nd edition
 
subject: action scope in struts 2
 
Similar Threads
parameter and scope interceptor
forwarding request to an action from a jsp page
Redirect url with in the action class
Struts 2 and passing data using interceptors
Scope Interceptor