我有一个共同基金2.0项目,我无法从中获取一个内容。
这里是我的网站:xml:
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FULL_STATE_SAVING_VIEW_IDS</param-name>
<param-value>/index.xhtml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.application.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
我可以取得“面对面”案文,但不能获得“面对面”案文。 问题在于:
FacesContext fctx = FacesContext.getCurrentInstance(); //works
//FaceletContext f2ctx = (FaceletContext) fctx.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
FaceletContext f2ctx = (FaceletContext) fctx.getELContext().getContext(FaceletContext.class);
Can anyone assist?
最新情况:
以上是我的总体目标中的一个幻灯塔:在需求时装上含有方言的立 face文件,然后添加到父母身上。 下面的法典不完整,但应当解释我正在做什么。 请注意,该信使用总理图书馆,因此是请求查阅。
public void launch() {
form.getChildren().clear();
FacesContext fctx = FacesContext.getCurrentInstance();
for (Object o: fctx.getAttributes().keySet()) {
System.out.println(o.toString());
}
FaceletContext f2ctx = (FaceletContext) fctx.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
//FaceletContext f2ctx = (FaceletContext) fctx.getELContext().getContext(FaceletContext.class);
dialog = new Dialog();
try {
f2ctx.includeFacelet(dialog, "/WEB-INF/facelets/dialog/manager.xhtml");
form.getChildren().add(dialog);
} catch (IOException ex) {
log.debug(ex.toString());
}
RequestContext.getCurrentInstance().update("mainPageCenterForm");
}