You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by super unknown <th...@gmail.com> on 2007/12/13 15:57:07 UTC

Posting html forms

I'm somewhat new to cocoon and have inherited a site developed using cocoon
2.1.5. I have some experience with Struts, jsp's and portlets.

>From what I can see the original developer created a component that extends
ServiceableGenerator. This is basically used to handle all requests to the
website and perform any business logic.

Is this an established principal when using cocoon? The reason I ask is that
the code is rather clumsy and is akin to the Magic Servlet antipattern.

Also with flow control, given the following :

<map:generate type="WebsiteTxn"/>
<map:transform src="postForm.xsl"/>
<map:serialize type="html"/>

If there is an error using the generator we are committed to using
postForm.xsl, is there anyway one could redirect to another section in the
sitemap?

Thanks.

Re: Posting html forms

Posted by so...@apache.org.
On 12/18/07, angel.of.cynicism <th...@gmail.com> wrote:
> solprovider wrote:
> > While I love writing Java and have written Cocoon Generators, I believe
> > only new standard components should require programming Java with Cocoon.
> When you say 'new standard components' thats for the website I am
> developing?

My definition of "standard components" requires the component to be
generic --useful for multiple applications.  A generator pulling data
from your database structure is not generic.  A generator that can be
configured to pull data from any SQL database is "standard."

I wrote an enhancement of URLSource to pass Cookies between clients
and backend servers when the protocol is HTTP.  This allows the
backends to maintain sessions without affecting Cocoon's sessions or
requiring any special programming.  This "standard component" is
useful for many applications -- anytime Cocoon displays data from
another Web application.  (I want to commit the two files, but do not
want to add new functionality just before the final release of Cocoon
2.1.)

You may need to add components if you are building a platform.
Writing a business application with Cocoon should not require
compiling Java.

> Based on the nature of the site I cannot see us getting away from writing
> java code, each business transaction communicates to web-service. Would
> inheriting off the ServiceableAction for request handling be a valid
> consideration?

Research "Web Service" and "SOAP".  While the original definition of a
Web Service did not require XML, the term currently means responding
to HTTP requests with XML.  Cocoon has components specifically for Web
Services, but Cocoon's default components are sufficient for almost
any functionality involving Web Services.

I have yet to see code using an Action that could not be improved by
replacing the Action with other components.  Actions seem to be used
when a programmer has been developing with Cocoon's XML for a week and
needs a reason to write some Java.  Cocoon 2.1 has trouble with
Actions: error-handling does not work properly and other strange
behaviors occur.  Including an Action in your application design
suggests insufficient understanding of Cocoon.  (Like seeing ArrayList
in Java code: you know the programmer learned Visual Basic first and
is unlikely to learn proper use of data structures.)  With Cocoon, the
goal is to get the data into XML, process the data using XMAPs and
XSLTs, then serialize into whatever format is needed.

Web Service Transaction using Cocoon:
1. Accept Web Form.  (RequestGenerator? or post.xsp.)
2. Transform to Web Service request.
3. Send request and receive response.
4. Transform Web Service response to required information.
5. Format, add navigation, serialize to HTML.

No Actions.  #3 needs a transformer that sends a fragment of the
current document to a URLSource and places the response into the
current document.  This seems easy and useful, but I do not see a
standard transformer with this functionality.  This is a good example
of a desirable new standard component.

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Posting html forms

Posted by "angel.of.cynicism" <th...@gmail.com>.


solprovider-2 wrote:
> 
> While I love writing Java and have written Cocoon Generators, I believe
> only new standard components should require programming Java with Cocoon.  
> 
When you say 'new standard components' thats for the website I am
developing?

Based on the nature of the site I cannot see us getting away from writing
java code, each business transaction communicates to web-service. Would
inheriting off the ServiceableAction for request handling be a valid
consideration?


solprovider-2 wrote:
> 
> The previous developer was not using Cocoon well.  
> 
Indeed, this was blatantly obvious after 5 minutes...was not even using Java
well.
-- 
View this message in context: http://www.nabble.com/Posting-html-forms-tp14324948p14387674.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Posting html forms

Posted by so...@apache.org.
Hi Super,

Welcome to Cocoon.

1. Best Practices
There is a schism between people using Cocoon as a framework for Java
development and people using Cocoon because Cocoon is a very cool URL
parser and XML/XSL engine.  Your original developer belonged to the
first group.  While I love writing Java and have written Cocoon
Generators, I believe only new standard components should require
programming Java with Cocoon.  The previous developer was not using
Cocoon well.  You could ask this ML how to reproduce the function of
the WebsiteTxn Generator with standard components.  Our responses
improve when posts include details like what is desired,

2. Error Handling
http://cocoon.apache.org/2.1/userdocs/concepts/errorhandling.html
Just add <map:handle-errors>.  There is an undocumented feature that
error handling does not work if <map:act> is used in a higher
pipeline.

solprovider

On 12/13/07, super unknown <th...@gmail.com> wrote:
> I'm somewhat new to cocoon and have inherited a site developed using cocoon
> 2.1.5. I have some experience with Struts, jsp's and portlets.
>
> From what I can see the original developer created a component that extends
> ServiceableGenerator. This is basically used to handle all requests to the
> website and perform any business logic.
>
> Is this an established principal when using cocoon? The reason I ask is that
> the code is rather clumsy and is akin to the Magic Servlet antipattern.
>
> Also with flow control, given the following :
>
> <map:generate type="WebsiteTxn"/>
> <map:transform src="postForm.xsl"/>
> <map:serialize type="html"/>
>
> If there is an error using the generator we are committed to using
> postForm.xsl, is there anyway one could redirect to another section in the
> sitemap?
>
> Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org