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

What is the purpose of @doublerangefieldvalidator annotation?

1037


What is the purpose of @result annotation?

1154


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

937


Do you need an alignment after replacing struts?

947


What is includeaction?

999


What is actioninvocation?

960


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

984


How you will display validation fail errors on jsp page?

944


Explain about tiles?

1055


What is the purpose of @element?

1017


What is the significance of logic tags in Struts?

988


What is the purpose of @conversionerrorfieldvalidator annotation?

1189


What is the configuration files used in struts?

957


State the procedure for using forward attribute of link tag’s.

958


Is there a particularly good ide to use with struts?

925