public Object getActionBean(Class<?> objClass, boolean create, String ownerProperty)
{
if (objClass==null)
return null;
// get the object key
ActionContext context = ActionContext.getContext();
String key = getActionBeanName(context, objClass, ownerProperty);
if (key==null)
return null;
// get the object from the session
Object obj = context.getSession().get(key);
if (obj==null && create)
{ try {
obj = objClass.newInstance();
context.getSession().put(key, obj);
} catch(Exception e) {
log.error("Cannot create Instance of type " + objClass.getName(), e);
}
}
return obj;