Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

action scope in struts 2

 
Asha Ramprasad
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Asha Ramprasad
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 485
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much.

Now i understand.
 
Bhanuprasad saketi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic