-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3900517
By: nobody
Did anybody try to get them work togheter?
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3903205
By: tomyeh
I encourage you to do it:) We'll help if you encounter any issue.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3904379
By: simon_massey
there is a new how-to on the wiki about struts+tiles+jsp+spring which should be a good starting point for get webflow working.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4080969
By: adriano_rossi
Hi Tom,
I answer to this thread after a long time because my attention has been forced to different matters for some months. Anyway I investigated the problem and I found this solution (I omit the webflow installation and configuration
details):
Suppose to have a simple web flow xml file like this:
<flow start-state="pageA">
<view-state id="pageA" view="pA">
<transition on="submit" to="pageB"/>
</view-state>
<view-state id="pageB" view="pB">
<transition on="submit" to="pageC"/>
<transition on="cancel" to="pageA"/>
</view-state>
<end-state id="pageC" view="pC"/>
</flow>
This is a flow of three pages. Each page has one form to collect data. From pageA you go to pageB. Form pageB you can go to pageC or go back to pageA. The pageC ends the flow.
For pageA - and for all the pages having only one output transition - you enclose the zul statements in a html form containing also two hidden fields for the webflow management: _flowExecutionKey for the flow state tracking and _eventId for the transition triggering.
This is the code snippet:
<h:form id="flowForm" action="my-test.htm" method="POST">
<h:input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}"/>
<h:input type="hidden" name="_eventId" value="submit"/>
<textbox id="firstName" name="name" value="John" constraint="no empty"/>
<button label="Yep" onClick="update()"/>
<zscript><![CDATA[
import org.zkoss.zk.ui.util.Clients;
void update() {
//validate data
firstName.getValue();
//submit the form
Clients.submitForm(flowForm);
}
]]></zscript>
</h:form>
In this case the transition triggering value "submit" is wired on the _eventId.
For pageB - and for all the pages with multiple output transitions - you have to compute and set the value at run time in this way:
<h:form id="flowForm" name="form" action="my-test.htm" method="POST">
<h:input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}"/>
<h:input type="hidden" name="_eventId" value=""/>
<textbox id="firstName" name="name" value="John" constraint="no empty"/>
<button label="Yep" onClick="update(SUBMIT)"/>
<button label="Nop" onClick="update(CANCEL)"/>
<zscript><![CDATA[
import org.zkoss.zk.ui.util.Clients;
String SUBMIT = "submit";
String CANCEL = "cancel";
void update(String target) {
//validate data
firstName.getValue();
// setup flow transition target
target = "document.form._eventId.value = '" + target + "';";
Clients.evalJavaScript(target);
//submit the form
Clients.submitForm(flowForm);
}
]]></zscript>
</h:form>
That's all.
Frankly speaking, I don't like a lot this solution because it has a "jsp/struts"
taste. As i am trying to use webflow to build some data entry wizards, I am investigating also a different solution more ZK compliant. The idea is to build some classes that work following the pattern of Eclipse's wizards. As soon as I have something of concrete I'll let you know.
Happy 2007 to everybody!
Adriano
Asked: 2006-09-05 19:16:54 +0800
Seen: 419 times
Last updated: Jan 02 '07