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
How you will display validation fail errors on jsp page?
What does params interceptor?
What is the naming convention for a resource bundle file in struts2?
How to convert struts to spring mvc?
How we can configured action mapping in struts?
What configuration changes are required to use resource files in Struts?
What are the reasons for an error message not being displayed while developing struts application?
What is difference between actionform and dynaactionform?
What are different Struts2 tags? How can we use them?
How interceptor works in struts 2?
What are the core classes of the struts framework?
What is http redirect?
How tag libraries are defined in Struts?
What is the use of namespace in action mapping in Struts2?
What is struts and why it is used?