I need to display name from database using type ahead feature in my web application. I used Dojo filtering select to display names . those names have to be displayed in multiple
jsp page. I have a
Java class named getClientNames() that gets the list of names from the database . based on a condition list of names will vary. So i will pass a parameter to that java class ,based on the parameter it executes the query.
eg,
public class X{
public List<
String> getNames(String param){
if param.equals("x"){
//query 1
}
else{
//query 2
}
return clisntList;
}
i have a Singleton class to call getNames method.
public class ClassicSingleton {
private static ClassicSingleton instance = null;
List<String> clientList;
protected ClassicSingleton() {
// Exists only to defeat instantiation.
}
public static ClassicSingleton getInstance() {
if(instance == null) {
instance = new ClassicSingleton();
}
return instance;
}
public List<String> getName(){
X obj=new obj();
this.clientList=obj.getNames(param);
return this.clientList;
}
}
i need to pass a parameter to this singleton method getName to get proper result. How can i achieve it..