Hi,
How do I call a method of another class based on the class name returned from database?
for example
- public class ActParent {}
- public class ActChild1 extends ActParent {
public void execute(Bean bean){
}
}
- public class ActChild2 extends ActParent {
public void execute(Bean bean){
}
}
- public class WebDriver {
protected void process() {
String className = getClass(request.getParameter("ACT")); //get class name from database based on query string
//process execute() function using String className ??????
}
}
I heard about a third party eval() function which works the same as the javascript eval() which executes the the String at runtime. I am not sure if it will work or it is the best option. Does anyone know offhand the best way to do it?
Another question. Is it recommended to use two Hash Map as instance variables in a bean? To retrieve a value from a bean is bean.getValue(ScopeString, KeyString).
Thanks
clark
How do I call a method of another class based on the class name returned from database?
for example
- public class ActParent {}
- public class ActChild1 extends ActParent {
public void execute(Bean bean){
}
}
- public class ActChild2 extends ActParent {
public void execute(Bean bean){
}
}
- public class WebDriver {
protected void process() {
String className = getClass(request.getParameter("ACT")); //get class name from database based on query string
//process execute() function using String className ??????
}
}
I heard about a third party eval() function which works the same as the javascript eval() which executes the the String at runtime. I am not sure if it will work or it is the best option. Does anyone know offhand the best way to do it?
Another question. Is it recommended to use two Hash Map as instance variables in a bean? To retrieve a value from a bean is bean.getValue(ScopeString, KeyString).
Thanks
clark