标签: commandbutton

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
查看次数

&lt;p:commandButton global =“ false”&gt;属性有什么作用?

是什么设置时之间的差异global的属性<p:commandButton>false或将其设置为true。我正在浏览primefaces展示柜,但无法理解其中的区别。

jsf global primefaces jsf-2 commandbutton

2
推荐指数
1
解决办法
4436
查看次数

如何在h:form submit期间将查询参数附加到POST请求

当我<h:form>在下面提到的页面中单击标签的命令按钮时,我希望在我点击提交按钮后,查询参数作为请求参数发送,就像我的页面URL一样../index.xhtml?cid=12&ctype=video.

我希望在我的动作方法中它应该被打印CID=12,然而,它打印出来CID=NULL.有什么问题,如何解决?

我的看法:

<h:body id="body">
    <h:form id="form">    
        <p:commandButton action="#{authorizationBean.getParameters()}" value="Ajax Submit" id="ajax" />   
    </h:form> 
</h:body>
Run Code Online (Sandbox Code Playgroud)

我的托管bean:

@ManagedBean
@SessionScoped
public class AuthorizationBean {

    public boolean getParameters(){
        Map<String, String> parameterMap = (Map<String, String>) FacesContext.getCurrentInstance()
                    .getExternalContext().getRequestParameterMap();
        String cid = parameterMap.get("cid");
        System.out.println("CID="+cid);
        return true;
    }

}
Run Code Online (Sandbox Code Playgroud)

jsf get primefaces commandbutton

2
推荐指数
1
解决办法
3129
查看次数

如何启用/禁用Primefaces CommandButton?

屏幕上有两个按钮。当页面第一次加载时,我想要的button2被禁用,直到单击button1。单击button1时,必须启用button2。

我试过了:

<p:commandButton value="Normalize"
    actionListener="#{mainTable.normalize}" update="dataTable"
    id="normalize" styleClass="ui-priority-primary"
    style="font-size: 14px">
    <f:setPropertyActionListener value="#{true}"
        target="#{mainTable.disable}" />
</p:commandButton>
<p:commandButton value="To Verify Next->" action="verify.xhtml"
    actionListener="#{mainTable.verify}" id="next"
    styleClass="ui-priority-primary" style="font-size: 14px"
    disabled="#{!(bean.disable)}">
</p:commandButton>
Run Code Online (Sandbox Code Playgroud)

我的豆子:

@ManagedBean
@SessionScoped
public class MainTable
{

    private boolean disable;

    public MainTable()
    {
        disable = false;
    }
    public boolean isDisable()
    {
        return disable;
    }

    public void setDisable(boolean disable)
    {
        this.disable = disable;
    }
}
Run Code Online (Sandbox Code Playgroud)

但这是行不通的。当我单击button1时,button2仍被禁用。怎么了?

jsf primefaces jsf-2 commandbutton

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

<p:blockUI>不响应<h:commandButton> <f:ajax>

我得到了一个<h:commandButton像:

<h:commandButton id="login"
  actionListener="#{bean.login}" value="Login"
  styleClass="btn btn-primary btn-sm">
   <f:ajax execute="@form" render="@form"/>
</h:commandButton>
Run Code Online (Sandbox Code Playgroud)

和a

<p:blockUI id="block" block=":form" trigger="login" />

它不起作用.该块永远不会显示出来.

它确实适用于<p:commandButton>.

我怎样才能实现它<h:commandbutton>.如果那是不可能的:有没有解决方法?

blockui primefaces jsf-2 commandbutton

2
推荐指数
1
解决办法
1223
查看次数

FaceletException:与元素类型"h:commandButton"关联的属性"value"的值不得包含"<"字符

我试图创建一个带有值的命令按钮<<.

<h:commandButton value="<<" />
Run Code Online (Sandbox Code Playgroud)

但是,它抛出了以下异常:

javax.faces.view.facelets.FaceletException:Error Parsing /test.xhtml:Error Traced [line:42]与元素类型"h:commandButton"关联的属性"value"的值不得包含"<"字符.

如何创建这样的按钮?

jsf brackets commandbutton

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

h:commandbutton with ajax 调用错误的动作方法

我对<h:commandButton>带有<f:ajax>标签的jsf 有问题。如果它有<f:ajax>标签,它会调用支持 bean 中的其他actionactionListener方法。如果它没有<f:ajax>标签,它会调用自己正确的action方法。这是我的片段:

 <h:form>
    <h:panelGroup id="loanContent" layout="block">
        <ui:include src="#{mainView.typePage}.xhtml"/>
    </h:panelGroup>
    <h:commandButton id ="rLoanBtn" value="Create" action="#{mainView.createNewType}">
        <f:ajax execute="loanContent" render="@form"/>
    </h:commandButton>  
 </h:form>
Run Code Online (Sandbox Code Playgroud)

如果我省略<f:ajax execute="loanContent"/>部分,它工作正常。如果我保持原样,它会调用其他方法,这些方法负责相同形式的其他按钮。顺便说一句,mainView支持 bean 是一个ViewScoped托管 bean。

jsf action actionlistener commandbutton

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

<h:commandButton>不调用方法

我有一个 <h:commandButton>

   <f:metadata>
        <f:viewParam name="uri" value="#{pesquisaBean.selectedUri}" />
        <f:event listener="#{pesquisaBean.searchElement()}" type="preRenderView"></f:event>
    </f:metadata>
    <h:head>
        <title>Detalhes do Documento</title>
    </h:head>

       <h:body>
       <br />
       Detalhes do Documento

       <br />
       <br />
       <rich:dataTable value="#{pesquisaBean.documentDetailsByTitle}" var="result">

                <c:forEach items="#{pesquisaBean.variableNamesDetails}" var="vname">
                     <rich:column>
                         <f:facet name="header">#{vname}</f:facet>
                          #{result[vname]}
                     </rich:column> 

                </c:forEach> 
       </rich:dataTable>
       <br />
       <h:commandButton value="Excluir" action="#{pesquisaBean.delete()}" />
       <br />
       <br />
Run Code Online (Sandbox Code Playgroud)

和这个行动方法

  public void delete() {
    System.out.println("Hello");
    this.removeDocument(databaseModel, this.selectedDocument);

    System.out.println("");
    System.out.println("After deleting!!!!!!!!!!!!");
    StmtIterator result = databaseModel.listStatements();
    while( result.hasNext() ) {
        Statement stmt = result.next();
        System.out.println(stmt);
    }
Run Code Online (Sandbox Code Playgroud)

但是,命令按钮不会调用操作方法.我正在尝试Hello在方法的第一行打印,但它没有打印.

这是怎么造成的,我该如何解决?

jsf action managed-bean commandbutton

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

将 ActiveX 控件的命令按钮链接到模块

好的,这是我的问题。是否可以从 Excel 工作表上的 ActiveX 控件命令按钮调用模块?

场景如下:我有一个名为“菜单”的工作表。菜单上有 10 个 activeX Control 命令按钮。我需要命令按钮来调用或将其链接到模块。我对如何实现这一目标一无所知。有可能吗?如果是这样,我该怎么做?如果没有,还有其他选择吗?

在此输入图像描述

非常感谢。

excel vba module commandbutton

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