Make use of a value from a servlet to use it in a normal class
My Scenario : I have a servlet and two normal classes. X servlet y Class Z
Class.
X Servlet code :
Y y=new Y();
y.setMap(Map);//Value exists for Map[Found out by sysout]
Y Class :
public void setMap(HashMap<String,String> hash){
this.hash=hash;
System.out.println("Set:::"+this.hash.toString());
}
public HashMap<String, Boolean> getMap(){
System.out.println("Bean Class:::"+hash.toString());
return hash;
}
Z Class:
Bean bean=new Bean();
HashMap result=bean.getMap();
System.out.println(result);
It results to null. Can any one explain y it results in null.
No comments:
Post a Comment