0

This issue has been troubling me to no end!!

I have seen the forum post JSF f:ajax listener not called which describes my exact issue.

I am using JSF 2.0 and am using the Jquery mobile as an extension library.

I have actually copied the code exactly from the post, into my project (shown below).

I have the same managed bean set in session scope, printing out a line. I can see the bean successfully executing on the first input text the one assigned with an ajax listener

It doesn't however work for the button. In my use case, I want the button only to act as a bridge for calling the managed bean, so don't want the form to submit.

I am at a complete loss as to why the bean isn't executed?

I have no overriding JS classes either, and am using Jquery mobile only.

Is this a restriction on the Jquery framework? or more than likely an issue with my code?

S

<h:form id="f1">
<h:panelGroup id="switchSearchTexts">
    <h:inputText accesskey="s" alt="Search" id="searchBoxPeople" title="Search Plebeians" valueChangeListener="#{peopleBean.simplePersonQuery}" size="25" rendered="#{peopleBean.easySearch}">
        <f:ajax render="peopleDataTable" event="keyup" listener="#{contactsBean.morePressed}"
                immediate="true"/>
    </h:inputText>

    <h:inputText accesskey="s" alt="Search First Name" id="searchBoxFN" title="Search First Name" size="25" rendered="#{!peopleBean.easySearch}">
        <f:ajax render="moreButtonAsText" event="keyup" />
    </h:inputText>
</h:panelGroup>

<div id="expandBox">
    <h:inputText id="searchBoxLN" alt="Search Last Name" styleClass="hideToggle" title="Search Last Name" size="25" />
    <h:inputText id="searchBoxAddress" alt="Search Address" styleClass="hideToggle" title="Search Address" size="25" />
</div>

<h:commandButton type="button" styleClass="moreButtonAsText" id="moreButtonAsText" value="More">
    <f:ajax listener="#{contactsBeanFaces.morePressed}"/>
</h:commandButton>
</h:form>

*** CORRECTION ****


my apologies, I was seriously trying everything! and posted the wrong iteration of code!
I have found a great note: http://java.dzone.com/articles/ajax-jsf-joined which has been a huge help, however still no success. I am feeling jquery mobile is messing with the event?

I believe that there may also be a requirement for the button to be in a form?

Sorry abou the basic questions, however i am a Jdeveloper guy, who is kind of learning backwards.... the DOM and client java / html side of things is almost unfairly hidden with this application. I am loving client side libraries and learning whole lot through this process.... but a strong requirement is that I can call server side logic!

Any ideas would be very much appreciated!

4

1 回答 1

0

好的解决了。

问题是需要使用正确的签名事件作为输入参数来设置托管 bean。通过大量测试,我尝试使用同一个类来处理 AjaxBehaviorEvent。与上一个论坛上的相同示例一样。

当我声明一个 ActionListener 事件(符合按钮 jsf 动作)时,bean 被执行!

兴奋,并展示了新鲜的眼睛可以带来什么!

谢谢丹尼尔!

小号

于 2012-06-04T05:31:06.107 回答