What happens when Two users requests for same action class?
How the threads are controlled?

Answer Posted / rk

I do not see a single correct answer.

In Struts1, Action resources must be thread-safe or
synchronized. So Actions are singletons and thread-safe,
there should only be one instance of a class to handle all
requests for that Action. The singleton strategy places
restrictions on what can be done with Struts1 Actions and
requires extra care to develop.

However in case of Struts 2, Action objects are instantiated
for each request, so there are no thread-safety issues. (In
practice, servlet containers generate many throw-away
objects per request, and one more object does not impose a
performance penalty or impact garbage collection.)

reference:
http://www.javabeat.net/qna/690-struts-1x-vs-struts-20/

Is This Answer Correct ?    10 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain integrate log4j in struts2 application?

568


How to use forward action to restrict a strut application to mvc?

594


What is action support class in struts2?

569


How interceptor works in struts 2?

592


Why are springs better than struts?

605






Why aren’t the struts tags maintained as part of the jakarta taglibs project ?

546


What is the purpose of constant tag in struts.xml?

555


What is action chaining ?

634


What is the role of action class in struts?

558


What is token used for?

511


Explain about the validation steps which have to be carried during validation of client-side address?

545


What is the purpose of @element annotation annotation?

597


What is the difference between plain-validator and field-validator?

522


What is the apache struts vulnerability?

522


What is includeaction?

581