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
Why was reload removed from struts (since 1.1)?
What is the design role played by struts?
What are the core classes of the struts framework?
how to get the last 10 elements using logic:iterate in struts with hiernate from database.
Define struts?
Why do we use struts?
What are the sections into which a strut configuration file can be divided?
Explain the difference between plain-validator and field-validator in struts?
What do you mean by tiles in struts?
What is the purpose of @key?
What is difference between interceptors and filters?
What is the difference between shocks and struts?
What are the classes used in struts?
What is the use of jsonvalidation?
What is struts.devmode?