相关疑难解决方法(0)

commandButton/commandLink/ajax动作/侦听器方法未调用或输入值未设置/更新

有时,使用时<h:commandLink>,<h:commandButton>或者<f:ajax>,在action,actionListenerlistener与标签相关的方法根本不被调用.或者,bean属性不会使用提交的UIInput值进行更新.

有什么可能的原因和解决方案?

jsf action commandlink jsf-2 commandbutton

332
推荐指数
5
解决办法
20万
查看次数

类.. $ Proxy $ _ $$ _ WeldClientProxy'没有属性'...'

所以我正在努力让一个示例应用程序工作.我正在使用Primefaces 3.3M4-SNAPSHOT,JBOSS 7 web profile(CDI和JSF Mojarra).

我有我的支持bean:

@Named
@ViewScoped
@URLMapping(id = "viewEditor", pattern = "/editor/e", viewId = "/editor/editor.jsf")
public class ViewEditor implements Serializable {

public void deleteNode() {
    selectedNode.getChildren().clear();
    selectedNode.getParent().getChildren().remove(selectedNode);
    selectedNode.setParent(null);

    selectedNode = null;

}
}
Run Code Online (Sandbox Code Playgroud)

我的xhtml:

        <p:contextMenu for="docs">
            <p:menuitem value="View" update="documentPanel"
                icon="ui-icon ui-icon-search" oncomplete="documentDialog.show()" />
            <p:menuitem value="Delete"
                actionListener="#{viewEditor.deleteNode}" update="docs"
                icon="ui-icon ui-icon-close" />
        </p:contextMenu>
Run Code Online (Sandbox Code Playgroud)

当我运行我的应用程序时,这是我得到的例外:

javax.el.ELException: /editor/editor.xhtml: The class 'application.ViewEditor$Proxy$_$$_WeldClientProxy' does not have the property 'deleteNode'.
    com.sun.faces.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:94)
    com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
    com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183)
    javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
Run Code Online (Sandbox Code Playgroud)

有没有人像我一样遇到同样的问题?

primefaces cdi jsf-2 mojarra

6
推荐指数
1
解决办法
7820
查看次数

Managed Bean as Facelet参数使复合组件无法解析

在给定的情况下,我想将Facelet与不同的ManagedBeans一起使用,因此About操作bean作为参数给出:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html 
    xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:h="http://java.sun.com/jsf/html" >
<h:body>
    <ui:include src="ratings.xhtml" >
      <ui:param name="createAction" value="#{myOneCreateAction}" />
      <ui:param name="ratings" value="#{context.ratings}" />
    </ui:include>
</h:body>
</html>
Run Code Online (Sandbox Code Playgroud)

我给create动作作为参数value="#{myOneCreateAction}"

在该构面中,一个组件也在其他页面上多次使用-因此,我尝试在复合组件中对其进行重构。

<html xmlns="http://www.w3.org/1999/xhtml" 
  xmlns:ui="http://java.sun.com/jsf/facelets" 
  xmlns:h="http://java.sun.com/jsf/html" 
  xmlns:f="http://java.sun.com/jsf/core" 
  xmlns:io="http://java.sun.com/jsf/composite/inoutComponents">
<ui:composition>
    <rich:dataTable id="ratingTblId" 
    value="#{ratings}" 
    var="rating">
        <rich:column>
             <io:removeButton
                 id="removeButton"
                 actionMethod="#{createAction.removeRating}"
                 immediate="true"
                 render=":#{rich:clientId('ratingTblId')}" />

             <h:commandButton
                 id="removeButton2"
                 actionListener="#{createAction.removeRating}"
                 immediate="true" >                    
                    <f:ajax render="ratingTblId" />
              </h:commandButton>
        </rich:column>
</rich:dataTable>
</ui:composition>
</html>
Run Code Online (Sandbox Code Playgroud)

参见,如何actionMethod="#{createAction.removeRating}"针对组件给出方法。该组件本身如下所示:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:cc="http://java.sun.com/jsf/composite">
    <!-- INTERFACE --> …
Run Code Online (Sandbox Code Playgroud)

jsf facelets composite-component jsf-2

5
推荐指数
1
解决办法
1516
查看次数