0

Spring WebFlow and ZK

asked 2006-09-05 19:16:54 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3900517

By: nobody

Did anybody try to get them work togheter?

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2006-09-07 11:30:06 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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.

link publish delete flag offensive edit

answered 2006-09-08 05:02:17 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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.

link publish delete flag offensive edit

answered 2007-01-02 14:11:44 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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


link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2006-09-05 19:16:54 +0800

Seen: 419 times

Last updated: Jan 02 '07

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More