Oracle adf 如何在业务组件视图对象查询中使用where子句的会话属性值。?

Oracle adf 如何在业务组件视图对象查询中使用where子句的会话属性值。?,oracle-adf,Oracle Adf,在ADF fusion web应用程序中的sessionScoped托管bean(在有界任务流和adfc-config.xml文件中注册托管bean)中,我将会话中的属性设置为 FacesContext fctx = FacesContext.getCurrentInstance(); ExternalContext ectx = fctx.getExternalContext(); HttpSession userSession = (HttpSession) ectx.getSession(

在ADF fusion web应用程序中的sessionScoped托管bean(在有界任务流和adfc-config.xml文件中注册托管bean)中,我将会话中的属性设置为

FacesContext fctx = FacesContext.getCurrentInstance();
ExternalContext ectx = fctx.getExternalContext();
HttpSession userSession = (HttpSession) ectx.getSession(false);
userSession.setAttribute("compID", defaultCompany);
session属性在bean中工作正常,该值显示在有界任务流的jsf页面上,也显示在包含有界任务流as区域的jsf页面上

我正在使用表达式获取页面上的会话属性值

"#{sessionScope.compID}" 
在output text value属性中,但无法获取包含业务组件的模型项目中的值。我想在查询中使用compID会话属性值

Select.........where COMP_ID ='compID';
通过在bind variable value属性中设置值,并在where子句中传递新的creted bid变量,但其不起作用


因此,我想知道如何在业务组件视图对象查询的where子句中使用这个动态会话属性值?

您的VO或AM上需要一个接受参数的服务方法-您在JSF页面中调用这个方法,并将会话范围作为参数传递。 例如: 或

你可以尝试做下面博客中提到的事情


我的…最终解决方案,使用两个答案中的代码行

protected void prepareSession(Session session) {
Map sessionScope = ADFContext.getCurrent().getSessionScope();
String company = (String)sessionScope.get("compId");
System.out.println("Default Comapny in BC is: " + company);
super.prepareSession(session);
this.getSession().getUserData().put("Company", company);
System.out.println("After setting value in userData map of BC");
}
视图xml上使用的表达式

adf.userSession.userData.Company

![used expression in the bind variable value][1]

..我想在业务组件where子句中使用会话属性值,并在会话范围内的托管beanthnks行的viewcontroller层中的会话中设置该值,以设置this.getSession.getUserData.put(“key”,value)中的值)使用和工作…不能喜欢多个答案,因为使用了两个答案中的一些行。你应该开始使用ADFlogger而不是SOP