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 can we display validation errors on jsp page?
What is the purpose of execute() method?
Which components are available using actioncontext map?
What is the use of interceptor?
What is the purpose of @requiredstringvalidator?
What is the purpose of form-be tag in struct-config.xml?
What is the different actions available in struts?
What is actionservlet?
What steps are required to for an application migration from Struts1 to Struts2?
What is spring and struts in java?
What do you mean by actionservlet?
How struts 2 validation works?
For a single Struts application, can we have multiple struts-config.xml files?
How can we group related actions in one group in Struts?
What is structs 2 validation framework?