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 are frameworks used?
What are the core classes of the struts framework?
How do struts work?
What’s the utilization of struts.xml configuration file?
Can you explain value stack?
Difference between html tags and struts specific html tags
How you will display validation fail errors on jsp page?
Which interceptor is responsible for mapping request parameters to action class Java Bean properties?
What is used to display the intermediate result in an interceptor?
Can we have more than one struts-config.xml file for a single struts application?
Explain how to work with error tags?
What is apache struts vulnerability?
At the point, you should go for struts framework?
What is the purpose of @results?
What is actionservlet?