Helping ordinary people create extraordinary websites!
HOME TUTORIALS SCRIPTS WEB HOSTING BLOG FORUM
Get Our Newsletter
Email:

Use Continuations to Develop Complex Web Applications

By Abhijit Belapurkar
2005-04-22


Understanding the Application Logic

With the above explanation, understanding the application logic should be easy. The script first asks for a page identified by page/getRateAmt to be sent to the user. This matches the first pipeline in the sitemap, causing the JXTemplateGenerator component to pick up the file screens/getRateAmt.xml and pass it on to the next component in the pipeline. Listing 5 shows the XML file for that component, getRateAmt.xml:

Listing 5. The XML file for getRateAmt

<?xml version="1.0"?>

<page>
<title>Get Rate and Quantity of item to be purchased</title>
<content>
<form method="post" action="continue.#{$cocoon/continuation/id}">
<para>Enter Rate: <input type="text" name="rate"/></para>
<para>Enter Quantity: <input type="text" name="qty"/></para>
<input type="submit" name="submit" value="Next"/>
</form>
</content>
</page>
The important point to note in this file is that the action field of the form uses a JXPath expression, #{$cocoon/continuation/id}. The expression will be automatically replaced by the continuation id generated by Cocoon when the sendPageAndWait call corresponding to its page is executed in the control script. This will cause the form to be submitted to a URL that will match the regular expression continue.*, and thereby lead to the appropriate (the second one declared in our sitemap, actually) pipeline in the sitemap being activated. (This pipeline, as you saw previously, consists only of a call statement, which will resume the continuation identified by the given id.)

Tutorial Pages:
» A Programming Paradigm to Simplify MVC for the Web
» What is a Continuation, Anyway?
» Problems in Conventional Web development
» The Case for Continuations
» User-Centered Navigation
» You Make the Rules!
» The Continuations Repository
» An Example Application
» Web Continuations in Apache Cocoon
» The Application Sitemap
» The Application Logic
» Understanding the Application Logic
» Resuming the Continuation
» JavaScript vs. the Java language
» Continuations in Java code
» Pros and Cons of Continuations
» Conclusion
» Resources


First published by IBM DeveloperWorks


 | Bookmark
Related Tutorials:
» All about JAXP, Part 1
» Make Database Queries Without the Database
» Load List Values for Improved Efficiency
» 2 Ways To Implement Session Tracking
» A Simple Way to Read an XML File in Java
» Develop Aspect-Oriented Java Applications with Eclipse and AJDT