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 ACID test for fresh engineers??what is the pattern??
What are the loop holes of struts?
What is the configuration files used in struts?
Is struts action class singleton?
What is the use of forwardaction?
How to build struts application in eclipse?
What is action class? What are the types of action class?
Can you explain the directory structure for a struts folder in brief ?
In which method of action class the business logic is executed?
In struts.xml, what does the attribute "method" stands for in the "action" tag?
What are the benefits of Struts framework?
What is the role of a handler in mvc based applications?
What is struts2 framework?
What are the aware interfaces in struts2?
Why are frameworks used?