Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


When wil use singleton class in Struts

Answers were Sorted based on User's Feedback



When wil use singleton class in Struts..

Answer / dsr

The Action classes are singleton classes that are
instantiated once per class type per JVM, and all requests
for a specific action are routed through the same Action
class instance.

Is This Answer Correct ?    21 Yes 7 No

When wil use singleton class in Struts..

Answer / avani

Struts will create a single instance of the Action and
allow multiple threads to invoke execute(). This allows for
faster request processing, as the framework is not
continually creating new Action instances to handle each
request. But because a single object is shared between
multiple threads, you must observe proper threading
considerations, as other threads are likely to pummel
instance variables that hold state in the action.

Is This Answer Correct ?    10 Yes 2 No

When wil use singleton class in Struts..

Answer / sekhar babu

Sorry,

I posted the wrong answer Multiple instances of Action
Classes will create for each request. It will not create
multiple instances of Action class,

It will create only single object and uses that object

Is This Answer Correct ?    3 Yes 0 No

When wil use singleton class in Struts..

Answer / harikrishna rapuri

Suppose if u give more 300 requests at a time struts based
webapplication,in that time some servers(tomcat..etc)
creates another ActionServlet object .This is violation of
the Servlet Specification(Servlet behavior is single
instance and multi therading).So that struts frame work
designers use Actionservlet as a Sigleton class.

Is This Answer Correct ?    5 Yes 2 No

When wil use singleton class in Struts..

Answer / sekhar babu

No, It will create Instance of Action Class for each
request, internally it will use Single-ton Design pattern
for the ActionServlet.

In Action class we will actully write business logic, so
Action class is not SingleTon only ActionServlet is singleton

Is This Answer Correct ?    3 Yes 2 No

When wil use singleton class in Struts..

Answer / nikel

In struts 1.x version Action class follows Single Instance Multiple Threaded model.hence WebContainer creates object for a Action class per Session basis.so Action class is not ThreadSafe.But we can make it ThreadSafe by Synchronization mechanism.

But in Struts 2.x version Action class obj is created by WebContainer per request basis.So Action class is always threadsafe.

Is This Answer Correct ?    1 Yes 0 No

When wil use singleton class in Struts..

Answer / vitthal

Hi guys please help me !

I am developing struts 2 web application, i have problem about ACTION class object creation ,here ACTION class object create for every new request .How can i avoid this process

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Struts Interview Questions

can we change the order of parameters in execute()?

4 Answers   Polaris, Serco,


What is the flow of requests in struts based applications?

0 Answers  


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

0 Answers  


Explain about struts dispatch action?

0 Answers  


What is the purpose of struct-config.xml in struct2?

0 Answers  


How can forward action be used to restrict a strut application to mvc?

0 Answers  


Can we have multiple struts config files in a single web app?

0 Answers  


Can you explain aware interfaces in struts2?

0 Answers  


How to use dispatchaction?

0 Answers  


Which design pattern the interceptors in struts2 is based on?

0 Answers  


Hi All thanks in advance, iam new to j2ee currently in my project we r using struts with hibernate can i have one sample application like CRUD application with code or any tutorials liks r ebooks plz....?

1 Answers   IBM,


What are the steps required for setting up validator framework in struts?

0 Answers  


Categories