cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Ebert <michael.eb...@ebira.de>
Subject javaflow and selection list problem
Date Fri, 11 Mar 2005 10:44:14 GMT
Hi,

i have a problem using a javaflow class with a cform selection-list.
i want to take some value from an xml-file with jdom and pass them to
a cform with a selection list. the problem is, that the created list
has no entries.

the javascript examples don't help me much, because i don't know how
to construct the equivalent java object as argument for the
form.show() method.




my java class looks like:


import java.io.IOException;

import org.apache.cocoon.components.flow.java.AbstractContinuable;
import org.apache.cocoon.components.flow.java.VarMap;
import org.apache.cocoon.forms.flow.java.FormInstance;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;

public class FormTest extends AbstractContinuable
{
        public void dodeleteJahr()
        {
        
                        FormInstance form = null;


                        form = new FormInstance("delete_jahr_form.xml");

                        Document jdoc = null;
                
                        SAXBuilder saxBuilder = new SAXBuilder();
                        try 
                        {
                                jdoc = saxBuilder.build("navigation.xml");
                        } 
                        
                        catch (JDOMException jdome) 
                        {
//                              ...
                                
                        } 
                        
                        catch (IOException ioe) 
                        {
//                              ...
                        }
                        
                        
                        VarMap map = new VarMap();
                        
                        for(int i = 0; i < jdoc.getRootElement().getChildren("jahr").size()+1;
++i)
                        {
                                
                                map.add("jahr"+i, "wert "+i);
                                
                        }
                        
                        form.show("templates/delete_jahr_template.xml", new VarMap("jahrList",
map));
        }
}




and my cform-document looks like:


<?xml version="1.0" encoding="UTF-8"?>
<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition">
        <fd:widgets>
                <fd:field id="delete_jahr">
                        <fd:label>Wählen Sie das Jahr, das Sie löschen möchten: </fd:label>
                        <fd:datatype base="string"/>                    
                        <fd:selection-list  type="flow-jxpath" list-path="jahrList" value-path="value"
label-path="label" />
</fd:field>
        </fd:widgets>
</fd:form>



The created list contains no items. I know that I have to pass a
VarMap to the form.show() method, but I don't know how the VarMap has
to look like.

I only found examples with javascript, but I want to avoid using
javascript.

Is there anyone who has experiences with this kind of problem?



Best regards,

Michel


-----------------------------
Michael Ebert

Ebert + Grüntjes GbR
Zeil 65-69
60313 Frankfurt
Tel.: +49 69 928879-17
Mail: michael.ebert@ebira.de


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


Mime
View raw message