0

I'm facing a problem that the action in is not invoked. Here is the code:

<h:form id="ConfigForm" onsubmit="waitForSubmit();">
<table  class="configtable" cellpadding="0" cellspacing="0" >
    <tr>
    <td  class="configtd" style="padding-left:15px;;">
        <h:inputHidden id="packageMode" value="#{configBean.Config.isPackageMode}" />
        <h:inputHidden id="isArpEnableOld" value="#{configBean.isArpEnableOld}" />
        <h:inputHidden id="menuli" value="#{configBean.menuli}" />
        <h:inputHidden id="NetBusiness" value="#{configBean.hasNetBusiness}" />
        <input type="hidden" id="errorMsg" value="${text['ruijie.license.netbusiness'] }">
        <input type="hidden" name="other_tip" id="other_tip" value="<h:outputText value='#{text["certificate.other"]}'/>" />
        <input type="hidden" name="wirelessdevice_tip" id="wirelessdevice_tip" value="<h:outputText value='#{text["terminal.wirelessdevice"]}'/>" />
        <input type="hidden" name="configjs_tip1" id="configjs_tip1" value="<h:outputText value='#{text["configjs.tip1"]}'/>" />
        <input type="hidden" name="configjs_tip2" id="configjs_tip2" value="<h:outputText value='#{text["configjs.tip2"]}'/>" />
        <input type="hidden" name="pc_tip" id="pc_tip" value="<h:outputText value='#{text["terminal.pc"]}'/>" />
        <input type="hidden" name="config_reset" id="config_reset" value="<h:outputText value='#{text["config.reset"]}'/>" />

        <div id="otherconfigdiv" class="configdiv">
            <table id="otherconfigtable"  class="configtable" cellpadding="0" cellspacing="0">

                ...

                <tr>
                    <td class="configlefttd ">&nbsp;</td>
                    <td class="configrighttd ">
                        <h:commandButton value="#{text['action.save']}"  action="#{configBean.update}" styleClass="btn" onclick="return check();" />
                                <span class="cmbtnspn10"></span>
                             <input type="button" value="${text['action.reset']}" class="btn" onclick="reset();" />
                    </td>
                </tr>
            </table>
        </div>

    </td>
    </tr>
    </table>
</h:form> 

I had also tried other method in configBean also but they are all not work, tried to debug but the method have not called. In other page those method work just fine.

Here is the js code called in onclick:

var netBusiness = $("#configForm\\:netBusiness").attr("value");
    var isShowRgHall = $("#configForm\\:isShowRgHall")[0].checked;
    if(netBusiness == 'false' && isShowRgHall){
        var errorMsg = $("#errorMsg").attr("value");
        self.parent.$("#subframe").attr("src","../../webcontent/web/nocomponent.jsf?netbusinessmsg="+errorMsg+"&messagetype="+1);
        return false;
    }
    return true;

I think there is no problem with this js. Had debug this and it return true but the action still not being invoked.

Stuck with this in two days. And now I have no idea why this happen. Looking for help.

Thanks.

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
gamo
  • 1,549
  • 7
  • 24
  • 36
  • `" />` Are you SURE this is working??? – Kukeltje Mar 17 '16 at 07:58
  • 1
    Check for possible cause here: http://stackoverflow.com/questions/2118656/commandlink-commandbutton-ajax-backing-bean-action-listener-method-not-invoked. And always create an [mcve] – Kukeltje Mar 17 '16 at 07:59
  • @Kukeltje: it works in JSP (in other words, OP is likely using ancient JSF 1.x). – BalusC Mar 17 '16 at 08:11
  • @BalusC: I suspected that due to the ${ usage, but could not remember ever doing this myself long ago... – Kukeltje Mar 17 '16 at 08:22
  • @Kukeltje: JSP didn't support deferred EL in template text, so this was really "the only way" in order to get `#{...}` to run. OP could altenatively just have used `${...}` instead without the need for a whole ``. – BalusC Mar 17 '16 at 08:25
  • In that time I mostly used `${...}`, so that explains it... – Kukeltje Mar 17 '16 at 08:28

0 Answers0