jFr*_*tic 8 facelets primefaces jsf-2 glassfish-3
我有一个简单的Facelet标签:
<ui:composition>
<ui:insert />
</ui:composition>
Run Code Online (Sandbox Code Playgroud)
这是为了避免声明多个c:set
标签.
假设我在facelets taglib库中使用名称注册它view
,并像这样使用它:
<my:view bean="#{myController}">
<p:inputText value="#{bean.value}>
<p:ajax event="blur" process="@this" listener="#{bean.handleValueChanged}" />
</p:inputText>
</my:view>
Run Code Online (Sandbox Code Playgroud)
该属性value
完全由你解决p:inputText
,但p:ajax
抛出这个:
Target Unreachable, identifier 'bean' resolved to null
javax.el.PropertyNotFoundException: Target Unreachable, identifier 'bean' resolved to null
at com.sun.el.parser.AstValue.getTarget(AstValue.java:153)
at com.sun.el.parser.AstValue.invoke(AstValue.java:237)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:302)
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:39)
at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
at org.primefaces.component.behavior.ajax.AjaxBehaviorListenerImpl.processAjaxBehavior(AjaxBehaviorListenerImpl.java:47)
Run Code Online (Sandbox Code Playgroud)
这是一个错误或预期的行为?
更新:我刚用f:ajax尝试了同样的工作!
顺便说一句,环境如下:
Glassfish 3.1.2
PF 3.0,3.2,3.3
Update2:
这个问题RichFaces
完全相同.似乎就像PrimeFaces的bug(我今天会在PF bug跟踪器上发布一个问题).
我的同事刚刚提供了一个补丁来解决这个问题。
目前的实现情况AjaxBehaviorListenerImpl#processAjaxBehaviour
如下:
public void processAjaxBehavior(AjaxBehaviorEvent event) throws AbortProcessingException {
FacesContext context = FacesContext.getCurrentInstance();
final ELContext elContext = context.getELContext();
try{
listener.invoke(elContext, new Object[]{});
} catch (MethodNotFoundException mnfe) {
MethodExpression argListener = context.getApplication().getExpressionFactory().
createMethodExpression(elContext, listener.getExpressionString(), null, new Class[]{event.getClass()});
argListener.invoke(elContext, new Object[]{event});
}
}
Run Code Online (Sandbox Code Playgroud)
他建议这样调整:
import javax.faces.view.facelets.FaceletContext;
Run Code Online (Sandbox Code Playgroud)
public void processAjaxBehavior(AjaxBehaviorEvent event) throws AbortProcessingException {
FacesContext context = FacesContext.getCurrentInstance();
final ELContext elContext = context.getELContext();
try{
listener.invoke(elContext, new Object[]{});
} catch (MethodNotFoundException mnfe) {
FaceletContext fc = (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
MethodExpression argListener = context.getApplication().getExpressionFactory().
createMethodExpression(fc, listener.getExpressionString(), null, new Class[]{ event.getClass() });
argListener.invoke(elContext, new Object[]{ event });
}
}
Run Code Online (Sandbox Code Playgroud)
希望这能得到 PF 团队的批准。
归档时间: |
|
查看次数: |
2008 次 |
最近记录: |