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
Why are frameworks used?
What are the pros of struts 2?
Will the struts tags support other markup languages such as wml ?
Are actions thread safe?
Why use spring, if you are already using struts?
What is the default suffix for Struts2 action URI and how can we change it?
In which order struts framework searches for a message bundle?
What is role of actionservlet?
Does struts include its own unit tests?
What is the purpose of @after annotation?
How can we upload files in Struts2 application?
What's mvc pattern ?
Explain about the library tag?
How long do struts last?
Is there a particularly good ide to use with struts?