I have a simple app with several pages that all maintain a single xforms instance (the context). The context contains an "action" element to drive the page-flow navagation (much like the tutorial examples) with additional elements that contain information for accessing a propritary database using a java processor that I wrote as the "model". Each of the pages has several submit buttons that set the "action" element as in the tutorial.
(I have trimed down my example so I may have made a syntax error somwhere in the process, but I assure you that except for the problem described below, all of these "parts" do work)
The context looks like this:
<xforms:model xmlns:xforms="http://www.w3.org/2002/xforms">
<xforms:instance> <context> <target> <host/> <port/> <keep-name/> <cell-name/> </target> <action/> </context> </xforms:instance> <xforms:submission method="post"/></xforms:model>
What I would like to do is have the "action" element both select a new page, and also select an action for my java processor to perform.
For example, I might have a "home" that forwards to a "facelist" page as follows:
<page
id="home" path-info="/"> <action><result
page="facelist"> <xu:update select="/context/target/host">localhost</xu:update> <xu:update select="/context/target/port">6666</xu:update> <xu:update select="/context/action">face-list</xu:update></result>
</action></page>
<page
id="facelist" path-info="/ttool/facelist" xforms="common/context.xml" model="common/tfreq.xpl" view="facelist/view.xsl"> <action when="/context/action=''"><result
page="facelist"> <xu:update select="/context"><xu:copy-of
select="document('oxf:instance')/context/*"/> </xu:update></result>
</action>/////// more actions here ///////
</page>
In addition to other actions, the "refresh" action is just supposed to refresh the screen (the face list could be updated by another user while it is displayed). Notice that I copy the entire "context" to the instance form before going back to the facelist page. The intention is that the "tfreq.xpl" will execute my java processor, which will retrieve the face list and drive the "facelist/view.xsl" to display it.
My problem is that when the "home" page forwards to the "facelist" page, it appears that the action list is interpreted before the "facelist" page is even displayed. In fact, according to the traces in the orbeon studio, the "facelist" page goes into an infinite loop as follows:
2004-11-29 21:44:57,718 INFO org.orbeon.oxf.pipeline.InitUtils null - /ttool/facelist - Timing: 31 - Cache hits: 77, fault: 0, adds: 0, success rate: 100%
2004-11-29 21:44:57,718 INFO org.orbeon.oxf.pipeline.InitUtils null - /ttool/facelist - Received request
2004-11-29 21:44:57,750 INFO org.orbeon.oxf.pipeline.InitUtils null - /ttool/facelist - Timing: 32 - Cache hits: 77, fault: 0, adds: 0, success rate: 100%
2004-11-29 21:44:57,750 INFO org.orbeon.oxf.pipeline.InitUtils null - /ttool/facelist - Received request
2004-11-29 21:44:57,781 INFO org.orbeon.oxf.pipeline.InitUtils null - /ttool/facelist - Timing: 31 - Cache hits: 77, fault: 0, adds: 0, success rate: 100%
2004-11-29 21:44:57,781 INFO org.orbeon.oxf.pipeline.InitUtils null - /ttool/facelist - Received request
2004-11-29 21:44:57,812 INFO org.orbeon.oxf.pipeline.InitUtils null - /ttool/facelist - Timing: 31 - Cache hits: 77, fault: 0, adds: 0, success rate: 100%
2004-11-29 21:44:57,812 INFO org.orbeon.oxf.pipeline.InitUtils null - /ttool/facelist - Received request
2004-11-29 21:44:57,843 INFO org.orbeon.oxf.pipeline.InitUtils null - /ttool/facelist - Timing: 31 - Cache hits: 77, fault: 0, adds: 0, success rate: 100%
2004-11-29 21:44:57,843 INFO org.orbeon.oxf.pipeline.InitUtils null - /ttool/facelist - Received request
2004-11-29 21:44:57,875 INFO org.orbeon.oxf.pipeline.InitUtils null - /ttool/facelist - Timing: 32 - Cache hits: 77, fault: 0, adds: 0, success rate: 100%
2004-11-29 21:44:57,875 INFO org.orbeon.oxf.pipeline.InitUtils null - /ttool/facelist - Received request
forever.....
If I change the "action when" to look for 'face-listx', the loop stops and the face-list is displayed, but of course, the refresh action 'face-list' does not work. I have also tried using two action elements (user-action and model-action) so that I can send a "non-action" to tha page, but still fill in a model-action for the java processor. This also prevents the loop, but this means that I can't use the "action" attribute of an "action" element to execute my java processor diectly from the instance document. I use this mechanism to add an object to my database (using my java processor) and returning to the same page. I would have to be able to copy the user-action to the model-action before the "action" attribute was executed, and there is no way to do that (I don't think).
So, it looks like the action list is being executed before the face list is displayed. If the instance contains data that matches an "action" for the page, it is executed immediately, which results in the instance being copied and forwarding back to the page, where it happens all over again. Is this expected behavior? Even if the action list was executed before the display, I would still expect that this occurs only once.
Thanks in advance for your response.
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
