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 difference between Jakarta Struts and Apache Struts? Which one is better to use?
Mark the differences between html tags and strut specific html tags.
Why do we need struts?
What is the need of struts?
What is the purpose of @key annotation annotation?
What do you mean by tiles in struts?
Why was reload removed from struts (since 1.1)?
What is the purpose of struts.properties in struct2?
What is the purpose of @results annotation?
What are the core classes of struts?
How we can controlled duplicate form submission in struts?
Explain about the validation steps which have to be carried during validation of client-side address?
Explain the complete struts validator framework.
Is there a particularly good ide to use with struts?
What is struts 2 framework in java?