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

How does struts work?

550


How can we upload files in Struts2 application?

592


How we can controlled duplicate form submission in struts?

522


What is s token?

539


What should be the name of xml file used for validation in struts?

542






Briefly tell the two kinds of form beans.

565


What applications use apache struts?

499


What are the important methods of actionform?

591


What are pull and push mvc architecture and which architecture does struts2 follow?

508


What is the purpose of @stringlengthfieldvalidator annotation?

605


What is xml based validation in struts2?

562


How can we display validation errors on jsp page?

539


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

564


What are interceptors in struts 2?

583


How many instances of servlet usually run in a struts application ?

544