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...

how to implement singletun design patteren in struts?

Answer Posted / shaik baji

Singletun design patteren means we can't create more than
one object for that class which follws Singletun design
pattern.

We can implement it by using one "private" constructor and
one Factory mathod as like follows:

class Sample
{
public static Sample s = new Sample();

private Sample()//constructor
{

}
public static Sample getInstance()//static factory
method
{
return s;
}
}

public class SingleTun
{
public static void main(String arg[])
{
Sample s1= Sample.getInstance();
Sample s2= Sample.getInstance();

}

}

Is This Answer Correct ?    5 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can we display validation errors on jsp page?

967


What is the purpose of execute() method?

1010


Which components are available using actioncontext map?

1122


What is the use of interceptor?

909


What is the purpose of @requiredstringvalidator?

921


What is the purpose of form-be tag in struct-config.xml?

903


What is the different actions available in struts?

954


What is actionservlet?

945


What steps are required to for an application migration from Struts1 to Struts2?

982


What is spring and struts in java?

914


What do you mean by actionservlet?

947


How struts 2 validation works?

1009


For a single Struts application, can we have multiple struts-config.xml files?

936


How can we group related actions in one group in Struts?

914


What is structs 2 validation framework?

938