[solved] False dispatch on RichFaces AJAX call?

Splash Forums PrettyFaces Users [solved] False dispatch on RichFaces AJAX call?

This topic contains 1 reply, has 2 voices, and was last updated by  Christian Kaltepoth 7 years, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #17764

    mtsinc
    Participant

    I just ran into something strange here. I’m not sure if this has to do with the fact that I’m running a ragged configuration, changes in the XML for PrettyFaces or an outright bug, but I can’t come up with a rational explanation for this behaviour:

    I’m using the RichRaces SuggestionBox facility and PrettyFaces seems to be intercepting the AJAX requests and misrouting them.

    This is the tag setup:

    <h:inputText id="toVesselId" value="#{item.vesselId}">
    <a4j:support event="onblur"
    reRender="messages,dstGalCap,dstGalStart,dstGalStartX"
    ajaxSingle="true" action="#{woRackingBean.doChangeDest}" />
    </h:inputText>
    <rich:toolTip for="toVesselId">
    <span>Click and press the down-arrow key or begin typing
    a vessel ID</span>
    </rich:toolTip>
    <rich:suggestionbox id="suggestionBox" for="toVesselId"
    tokens=",[]" suggestionAction="#{woRackingBean.autocomplete}"
    var="result" fetchValue="#{result.id}" width="300"
    nothingLabel="No vessels found"
    columnClasses="left,right,right,right">

    <h:column>
    <h:outputText value="#{result.id}" />
    </h:column>
    <h:column>
    <h:outputText value="#{result.capacity}">
    </h:outputText>
    Cap.
    </h:column>
    <h:column>
    <h:panelGroup>
    <h:outputText rendered="#{not empty result.blendGallon}"
    value="#{result.blendGallon.gallons}"/>
    <h:outputText rendered="#{empty result.blendGallon}" value="0"/>
    <h:outputText value=" Used" />
    </h:panelGroup>
    </h:column>
    <h:column>
    <h:outputText rendered="#{result.inGroup}" value="G" />
    <h:outputText rendered="#{not result.inGroup}" value="-" />
    </h:column>
    </rich:suggestionbox>

    Here’s the pretty-config.xml:

    <pretty-config xmlns="http://ocpsoft.com/prettyfaces/3.0.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://ocpsoft.com/prettyfaces/3.0.2
    http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.0.2.xsd">
    <url-mapping id="editRacking">
    <pattern value="/workorder/racking/edit"/>
    <query-param name="wo">#{woRackingBean.wonum}</query-param>
    <view-id>/workorder/racking/WOAddEditRacking.jsf </view-id>
    <action>#{woRackingBean.doEditWO}</action>
    </url-mapping>
    </pretty-config>

    And the filter in web.xml (NOTE it’s retricted because of some other strange things that were happening when filtering globally):

    <filter>
    <filter-name>Pretty Filter</filter-name>
    <filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>Pretty Filter</filter-name>
    <url-pattern>/workorder/*</url-pattern>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>ERROR</dispatcher>
    </filter-mapping>

    As near as I can tell, when a request for a suggestionlist is made, the list is returned and displayed properly, but a call is made to the editRacking url-mapping as well. I have no idea why, since the current page url is /workorder/racking/WOAddEditRacking.jsf.

    Am I doing something wrong here or is this a bug?

    #20056

    What do you mean by “misrouting AJAX requests”? It sounds like your suggestion box is working well. When you browser shows /workorder/racking/edit and the suggestion box sends AJAX requests, these requests will be postbacks to the same URL. So PrettyFaces will process these requests, inject your query parameter AND call the action #{woRackingBean.doEditWO}. This is expected behavior. If you don’t want that your action is executed on postbacks, you can change this by setting onPostback attribute to false.

    See:

    http://ocpsoft.com/docs/prettyfaces/snapshot/en-US/html/Configuration.html#config.actions.postback

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Comments are closed.