Posts

Showing posts from April, 2011

My Struts Notes

Struts key points which I learned for an interview. Its My Notes Home ============================================================================= What is the disadvantage of DispatchAction ============================================================================= The main constraint in the DispatchAction is the method name in the action class and the button name in the jsp page should be the same. But in LookupDispatchAction, we can have different names for the buttons and the methods. Home ============================================================================= What is LookupDispatchAction in struts ============================================================================= Steps 1) Your action class has to extends to LookupDispatchAction 2) You have to implement protected Map getKeyMethodMap() public class UserAction extends LookupDispatchAction { protected Map getKeyMethodMap() { Map map = new HashMap(); map.put("UserEmployeeForm.add", ...
My notes for an interview which I gues will help Fact about SingleTon 1) if your singleTOn class implements the java.io.Serializable interface , the class's instances can be serialized and deserialized. However, if you serialize a singleton object and subsequently deserialize that object more than once, you will have multiple singleton instances. 2)SingleTon Class is not thread safe if(instance == null) { instance = new Singleton(); } 3) if you clone singleTon class , it will create a clone and there will be two different object will be created. You can print hashCode of each instance, it will be different 4) if you create synchronized method, it will always hit the performance whenever you you create object. public synchronized static Singleton getInstance() { if(singleton == null) { synchronized(Singleton.class) { singleton = new Singleton(); } System.out.println("Object created"); } return singleton; } 5) if you creat synchroni...