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
What is the purpose of @doublerangefieldvalidator annotation?
What is the purpose of @result annotation?
What are pull and push mvc architecture and which architecture does struts2 follow?
Do you need an alignment after replacing struts?
What is includeaction?
What is actioninvocation?
What is the purpose of struct-config.xml in struct2?
How you will display validation fail errors on jsp page?
Explain about tiles?
What is the purpose of @element?
What is the significance of logic tags in Struts?
What is the purpose of @conversionerrorfieldvalidator annotation?
What is the configuration files used in struts?
State the procedure for using forward attribute of link tag’s.
Is there a particularly good ide to use with struts?