相关疑难解决方法(0)

JSF跳过阶段 - 如何调试?

我正在调试一个外部JSF应用程序.问题是,我提交了一份表格,但价值没有结转.

使用阶段监听器,我可以看到生命周期没有完全运行,所以说它跳过阶段2 -5:在恢复视图阶段之后,直接调用渲染响应阶段.我想念应用值,验证,更新模型操作等等.

因此,这可能是一个鸡与蛋的问题:1.不会调用负责阶段,因此新表单输入无法结转.2.系统无法识别任何新输入,因此在恢复视图后直接渲染.

我检查了没有调用responseComplete()或者renderResponse()的调用.

我不知何故被卡住了.有任何想法验证两个假设之一吗?或者如何调试一般?有没有人有类似的问题?


更新

我怀疑,JSF不知道回发请求,并像初始视图一样处理它.这可以解释,我只通过了第1阶段和第6阶段.

如果JSF将此识别为非面部请求,我该如何检查?
如果当前有适当的treeID,我该如何检查facesContext.

jsf skip phase

3
推荐指数
1
解决办法
3287
查看次数

如何在 JSF 中构建“编辑”按钮并在 h:outputText 和 h:inputText 之间切换

如何创建“编辑”按钮,以便在单击该按钮时将 更改h:outputTexth:inputText

jsf edit conditional-rendering

3
推荐指数
1
解决办法
5337
查看次数

最初在disable ="true"时<p:commandButton>不工作

这是我的ManagedBean:

@Named(value = "mrBean")
@RequestScoped
public class MrBean {

   public void laugh() {
      System.out.println("HAHAHA");
   }

   public void prepareToLaugh() {
      System.out.println("Drink water.");
   }

}
Run Code Online (Sandbox Code Playgroud)

这是我的commandButton的工作版本:

<p:commandButton actionListener="#{mrBean.laugh}" widgetVar="laughtButton"
                 value="Laugh" oncomplete="laughButton.disable();"  />
Run Code Online (Sandbox Code Playgroud)

当我点击上面的按钮时,我看到HAHAHA了按钮被禁用.但是,当我将laughButton的disable属性设置为时true,该按钮不再起作用:

<p:commandButton actionListener="#{mrBean.laugh}" widgetVar="laughtButton"
                 value="Laugh" disabled="true" oncomplete="laughButton.disable();"  />

<p:commandButton actionListener="#{mrBean.prepareToLaugh}"
                 value="Prepare to laugh" oncomplete="laughButton.enable();" />
Run Code Online (Sandbox Code Playgroud)

当我点击第二个按钮时,我看到Drink water并启用了第一个按钮.但是,当我点击第一个按钮时,没有任何反应.

如果有人能就如何解决这个问题给我一个建议,我将非常感激.我正在使用PrimeFaces 3.0 RC2.

jsf button primefaces

3
推荐指数
1
解决办法
8554
查看次数

javax.el.MethodNotFoundException:找不到方法:TableBeanDetail@bd4053.onRowSelect()

当我单击每行中出现的数据表中的命令按钮时,我收到以下错误.通过查看示例,我了解到一旦单击了commandbutton,就会首先执行以下代码

 <f:setPropertyActionListener value="#{detailRow}" target="#{tableBeanDetail.selectedEntry}" />  
Run Code Online (Sandbox Code Playgroud)

然后是与以下bean方法关联的代码

  <p:commandButton id="detailsButton" actionListener="#{tableBeanDetail.onRowSelect}" icon="ui-icon-
      search" title="View Details">  
Run Code Online (Sandbox Code Playgroud)

在我的onRowSelect中我试图做以下事情:

  public String onRowSelect(ActionEvent event) throws Exception {


    // Get key fields from row data and set the parameters that needs to be passed w
             .....
 }
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

jsf jsp primefaces

3
推荐指数
1
解决办法
6695
查看次数

Primefaces commandButton动作属性未被调用

我正在创建带有Primefaces的JSF应用程序。基本上我有这种看法。有一个选项卡视图,其中每个选项卡都包含一个命令按钮和一个手风琴面板(另一种选项卡视图)。在其他元素中,手风琴面板的选项卡包含每个命令按钮。我的问题是,第一个命令按钮(在1级选项卡下)在单击时正确调用了操作方法,而第二个按钮(在2级选项卡下)未正确调用。我应该说tabView和AccordionPanel都正常工作,因为它们正在显示应显示的信息。

我正在发布视图的简化版本,以便您可以看到正在发生的事情。

<h:form>
<p:tabView id="unitTabs"  orientation="left" dynamic="true" cache="false" var="unit" value="#{unitController.getUnitsOfLoggedInUser(loginController.checkedUser)}">
    <p:tab id="unitTab" title="#{unit.unitName}">

    <p:commandButton value="Add Lecture" action="#{unitController.setTemporary(unit)}" onclick="createLectureDialog.show()">

    <p:accordionPanel id="lectureTabs" value ="#{lectureController.getLecturesForUnit(unit)}" var="lecture" dynamic="true" cache="false">

         <p:tab title="#{lecture.lectureName}">
              <p:commandButton value="Add Criterion" action ="#{lectureController.setTemporary(lecture)}" onclick="createCriterionDialog.show()" >
         </p:tab>
     </p:accordionPanel>
     </p:tab>
</p:tabView>
</h:form>
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?谢谢

jsf java-ee primefaces

3
推荐指数
1
解决办法
1万
查看次数

&lt;h:commandButton&gt; 不启动回发

我在 JBoss AS 7.1.1 上使用 JSF 2.1.7 和 Myfaces CODI 1.0.5。我<h:commandButton>的不工作。我已经阅读了要求并通过许多博客中的示例都无济于事。我的facelets代码如下

<ui:define name="pagecontent">  
    <h1 class="title ui-widget-header ui-corner-all">Upload Bulk Contact File</h1>
    <div class="entry">
        <h:form enctype="multipart/form-data" id="upload">
            <p:panel closable="false" collapsed="false" header="Excel Contact Uploader"
                id="pnlupload" rendered="true" toggleable="false" visible="true" widgetVar="pnlupload">
                <p:growl id="msg"  showDetail="true" life="3000" showSummary="true"/>
                <p:fileUpload auto="true" 
                    allowTypes="/(\.|\/)(xls)$/" 
                    sizeLimit="1024000" 
                    mode="advanced" 
                    multiple="true" invalidFileMessage="Invalid file type" invalidSizeMessage="File too
                    large" dragDropSupport="true" 
                    fileUploadListener="#{excelFileController.handleFileUpload}" showButtons="true"
                    update="msg, tblcontacts" required="false"/>
                <p:scrollPanel rendered="true" style="height:200px;">
                    <p:dataTable draggableColumns="false" editable="false" emptyMessage="No 
                        Contacts Uploaded" id="tblcontacts" rendered="true"  rows="8"
                        selection="#{excelFileController.contactsSelected}" 
                        value="#{excelFileController.contactDataModel}" var="contact" style="width:50pc;">
                        <p:column selectionMode="multiple" style="width:18px" …
Run Code Online (Sandbox Code Playgroud)

primefaces cdi jsf-2

3
推荐指数
1
解决办法
3931
查看次数

commandLink操作未执行

我有以下XHTML:

<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">
    <head>
        <title>TODO supply a title</title>
    </head>
    <body>
        <f:metadata>
            <f:viewParam id="productCV" name="productName" value="#{productBean.product}"
                         converter="#{productConverter}" required="true"/>
        </f:metadata>

        <ui:composition template="/templates/mastertemplate.xhtml">
            <!-- Define the page title for this page-->
            <ui:define name="pageTitle">
                <h:outputFormat value="#{msgs.productPageTitle}">
                    <f:param value="#{productBean.product.description}"/>
                </h:outputFormat>
            </ui:define>

            <!-- Pass the categoryName parameter to the sidebar so the category of this product is highlighted-->
            <ui:param name="categoryName" value="#{productBean.product.categoryName}"/>

            <ui:define name="content">
                <!-- If productconversion failed, show this error-->
                <h:message id="error" for="productCV" style="color: #0081c2;" rendered="#{productBean.product == null}" />

                <!-- If productconversion succeeded …
Run Code Online (Sandbox Code Playgroud)

jsf jsf-2

3
推荐指数
1
解决办法
9952
查看次数

JSF 操作从未​​在 h:commandButton 上触发(使用 f:ajax)

我阅读了很多关于 f:ajax 与其他 jsf 或 html 标签一起工作的内容,但这似乎还不够!

我的页面中有一个带有(必需的?)f:ajax 标记的 commandButton,并且该操作永远不会被触发。这是代码。

<html>
  <h:head>
  </h:head>

  <h:body>
    <h:form>
      <h:commandButton action="#{bean.myFirstFunction}" value="Submit">
        <f:ajax render=":wrap" />
      </h:commandButton>
    </h:form>

    <h:panelGroup id="wrap">
      <h:panelGroup id="content" rendered="#{bean.myVariable != null}">

       <h:form>
         <h:commandButton action="#{bean.mySecondFunction}" value="Submit">
           <f:ajax render=":wrap" />
         </h:commandButton>
       </h:form>

      </h:panelGroup>
    </panelGroup>
  <h:body>
</html>
Run Code Online (Sandbox Code Playgroud)

所以像上面一样,我有两个按钮,第一个从包装中工作,它必须显示隐藏在开头的包装面板。第二个是在包装中,必须启动一个完全不同的动作。(包装必须保持显示)

这是豆子。

@ManagedBean(name = "bean")
@ViewScoped
public class myBean {
  private Object myVariable;

  public void setMyVariable(Object o) { ... }
  public Object getMyVariable() { ... }

  @PostConstruct
  public void init() {
    this.myVariable = null;
  }

  public void …
Run Code Online (Sandbox Code Playgroud)

jsf render commandbutton

3
推荐指数
1
解决办法
8173
查看次数

commandButton inactive after ajax rendering

I have a problem with these two commandButton : Join and Leave.

I want to hide Join if I click on leave and vice-versa.

When I put ajax on false, there is no problem (but all the page is refresh and I don't find this optimal).

But when ajax attribut is on true with specific updating (cf comment in the code), the rendering is good but the new button whitch appear become inactive. If I click on it, nothing happens …

jsf renderer updates primefaces commandbutton

3
推荐指数
1
解决办法
2844
查看次数

将<f:ajax>添加到<h:commandButton>时,未在模型中更新提交的表单值

我正在学习如何在jsf中使用ajax,我创建了一个实际上什么都没有的页面,一个填充了数字的输入文本,提交给服务器,使用提交的值调用该元素的setter,并显示getter的值.

这是简单bean的代码:

@ManagedBean(name="helper",eager=true)
public class HealthPlanHelper {


    String random = "1";

    public void setRandomize(String s){
        random = s;
                System.out.println("Calling setter");
    }

    public String getRandomize(){
        return random;
    }

}
Run Code Online (Sandbox Code Playgroud)

和jsf页面:

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:f="http://java.sun.com/jsf/core">
<h:head></h:head>
<h:body>

    <h:form>
        <h:commandButton action="nothing">
            <f:ajax render="num"/>
        </h:commandButton>

        <h:inputText value="#{helper.randomize}" id="num"/>
    </h:form>

</h:body>
</html>
Run Code Online (Sandbox Code Playgroud)

如你所见,这是一个请求范围的bean,每当我点击按钮时服务器显示它创建了bean的实例,但是从不调用setter方法,因此,getter总是返回"1"作为值的串.

当我删除时,正常调用setter.

ajax jsf form-submit jsf-2

3
推荐指数
1
解决办法
4838
查看次数