cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Garvin Riensche <>
Subject CForms with actions
Date Tue, 03 May 2005 09:52:58 GMT
Hi there,

I want to figure out how CForms are working in combination with actions 
instead of flowscripts. Therefore I want to create an simple example 
like this: but 
without the flowscript.
The only example for CForms with actions I know can be found at the 
cocoon-blocks but it lacks documentation and is a bit too complex for 
me. So, what I did so far is, writing the form definition, the template 
file, the sitemap and one action.
If I unterstood it correctly one only has to write one java-file to 
initialize the form. The other actions that are needed are

But I am not sure how to the "initialize-action" has to look like and 
how i compile it correctly. I wrote it like this:

import org.apache.cocoon.environment.Redirector;
import org.apache.cocoon.environment.SourceResolver;
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.forms.acting.AbstractFormsAction;
import org.apache.cocoon.forms.formmodel.Field;
import org.apache.cocoon.forms.formmodel.Form;
import org.apache.avalon.framework.parameters.Parameters;

import java.util.Map;
import java.util.Date;

public class FormAction extends AbstractFormsAction {
    public Map act(Redirector redirector, SourceResolver resolver, Map 
objectModel, String source, Parameters parameters)
            throws Exception {
        String formSource = parameters.getParameter("form-definition");
        String formAttribute = parameters.getParameter("attribute-name");

        Form form = formManager.createForm(resolver.resolveURI(formSource));

        Request request = ObjectModelHelper.getRequest(objectModel);
        request.setAttribute(formAttribute, form);

        return null;

And I tried to compile it with

javac -classpath i:\projekte\cocoon-2.1.7\build\cocoon-2.1.7\classes 


but I get 100 errors which seems to come from the source files in 
..\forms\java\. But when I leave out the sourcepath to these files i get 
serveral errors like: package org.apache.cocoon.forms.acting does not exist
import org.apache.cocoon.forms.acting.AbstractFormsAction;

My question is, if my gerneral approach to create a form with actions is 
correct and if yes, how do i compile this java file.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message