You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Omar Adobati <om...@gmail.com> on 2006/08/29 11:13:26 UTC
CForm Definition and CForm Template issue
Good Morning, here is a snippet of code I'm trying to use:
== form definition ==
<fd:group id="name">
<fd:field id="firstname" required="true">
<fd:label>Nome</fd:label>
<fd:help>First name of the sender of the message</fd:help>
<fd:datatype base="string"/>
<fd:validation>
<fd:length min="2"/>
</fd:validation>
</fd:field>
<fd:field id="lastname" required="true">
<fd:label>Cognome</fd:label>
<fd:help>Last name of the sender of the message</fd:help>
<fd:datatype base="string"/>
<fd:validation>
<fd:length min="2"/>
</fd:validation>
</fd:field>
</fd:group>
== form template ==
<ft:form-template action="#{$continuation/id}.continue" method="POST">
<fi:group>
<fi:styling layout="columns"/>
<fi:items>
<ft:widget id="firstname"/>
<ft:widget id="lastname"/>
</fi:items>
</fi:group>
<input type="submit"/>
</ft:form-template>
but when I execute this code it tells me back that "Form has no child
named 'firstname'". This will be fixed removing the <ft:group> tag to
the definition file, but this isn't what I want...
So, does anyone could tell me how to resolve this problem?
Thanks a lot,
Omar
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Action Database Problem
Posted by Ralph Seidl <R....@ff-muenchen.de>.
Hi,
your class AmeliSelect extends javax.swing.AbstractAction
Try extending from org.apache.cocoon.acting.AbstractAction .
Maybe this will solve your problem.
Ralph
rachid harradi wrote:
> Hello,
>
> my AmeliSele "class" is:
>
>
> package dbmanager;
>
> import java.awt.Component;
> import java.awt.event.ActionEvent;
> import java.sql.Connection;
> import java.sql.PreparedStatement;
> import java.sql.ResultSet;
> import java.sql.ResultSetMetaData;
> import java.sql.SQLException;
> import java.sql.Statement;
> import java.sql.Time;
> import java.sql.Timestamp;
> import java.sql.Types;
> import java.util.ArrayList;
> import java.util.HashMap;
> import java.util.Iterator;
> import java.util.List;
> import java.util.Map;
>
> import javax.swing.AbstractAction;
>
> import org.apache.avalon.excalibur.datasource.DataSourceComponent;
> import org.apache.avalon.framework.activity.Disposable;
> import org.apache.avalon.framework.component.ComponentManager;
> import org.apache.avalon.framework.component.ComponentSelector;
> import org.apache.avalon.framework.component.Composable;
> import org.apache.avalon.framework.configuration.Configuration;
> import org.apache.avalon.framework.configuration.ConfigurationException;
> import org.apache.avalon.framework.parameters.Parameters;
> import org.apache.avalon.framework.service.ServiceException;
> import org.apache.avalon.framework.service.ServiceManager;
> import org.apache.avalon.framework.thread.ThreadSafe;
> import org.apache.cocoon.Constants;
> import org.apache.cocoon.ProcessingException;
> import org.apache.cocoon.acting.AbstractDatabaseAction;
>
> import org.apache.cocoon.environment.ObjectModelHelper;
> import org.apache.cocoon.environment.Redirector;
> import org.apache.cocoon.environment.Request;
> import org.apache.cocoon.environment.SourceResolver;
> import org.apache.commons.lang.StringUtils;
> import org.xml.sax.InputSource;
>
> import cuba.ComponentException;
>
> public class AmeliSelect extends AbstractAction implements ThreadSafe, Composable, Disposable {
>
> // private static final Map selectStatements = new HashMap();
> // private DBManager dbm = null;
> // private ServiceManager manager = null;
> // private InputSource inputSource = null;
> // DataSourceComponent datasource = null;
> protected ComponentSelector dbselector;
>
> protected ComponentManager manager;
> private static HashMap mappers = null;
>
> // public void service(ServiceManager serviceManager) throws
> // ServiceException {
> // System.out.println("[User.java | service] beginn");
> // this.manager = serviceManager;
> //
> // }
> public void compose(ComponentManager manager) throws org.apache.avalon.framework.component.ComponentException {
> // TODO Auto-generated method stub
> this.dbselector = (ComponentSelector) manager
> .lookup(DataSourceComponent.ROLE + "Selector");
> }
>
>
> // public void compose()
> // throws org.apache.avalon.framework.component.ComponentException {
> // this.dbselector = (ComponentSelector) manager
> // .lookup(DataSourceComponent.ROLE + "Selector");
> // }
>
> protected final DataSourceComponent getDataSource(String pool)
> throws org.apache.avalon.framework.component.ComponentException {
> return (DataSourceComponent) this.dbselector.select(pool);
> }
>
> public Map act(Redirector redirector, SourceResolver resolver,
> Map objectModel, String source, Parameters param) throws Exception {
> // DataSourceComponent datasource = null;
> // Connection conn = null;
> // int currentIndex = 0;
> //
> // // read global parameter settings
> // boolean reloadable = Constants.DESCRIPTOR_RELOADABLE_DEFAULT;
> // if (this.settings.containsKey("reloadable"))
> // reloadable = Boolean.valueOf((String)
> // this.settings.get("reloadable")).booleanValue();
> // // read local parameter settings
> // try {
> // Configuration conf =
> // this.getConfiguration(param.getParameter("descriptor", (String)
> // this.settings.get("descriptor")),
> // resolver,
> // param.getParameterAsBoolean("reloadable",reloadable));
> //
> // Request request = ObjectModelHelper.getRequest(objectModel);
> //
> // Configuration[] keys =
> // conf.getChild("table").getChild("keys").getChildren("key");
> // Configuration[] values =
> // conf.getChild("table").getChild("values").getChildren("value");
> //
> // PreparedStatement statement = null;
> // ResultSet rset = null;
> // boolean result = false;
> //
> // for (int i = 0; i < keys.length; i++) {
> // final String parameter = keys[i].getAttribute("param");
> // Object value = request.getParameter(parameter);
> // if (StringUtils.isEmpty((String)value)) {
> // if (statement == null) {
> // final String query = this.getSelectQuery(conf);
> // System.out.println("[User.java | User] pre");
> // this.dbm = (DBManager) this.manager.lookup(DBManager.ROLE);
> // System.out.println("[User.java | User] middle");
> // datasource = this.dbm.getDsc();
> // conn = datasource.getConnection();
> //
> // statement = conn.prepareStatement(query);
> // currentIndex = 1;
> // for (int j = 0; j < keys.length; j++, currentIndex++) {
> // this.setColumn(statement, currentIndex, request, keys[j]);
> // }
> // rset = statement.executeQuery();
> // result = rset.next();
> // }
> // if (result) {
> // value = this.getColumn(rset, request, keys[i]);
> // }
> // }
> // if (value != null) {
> // request.setAttribute(parameter, value.toString());
> // }
> // }
> //
> // for (int i = 0; i < values.length; i++) {
> // final String parameter = values[i].getAttribute("param");
> // Object value = request.getParameter(parameter);
> // if (StringUtils.isEmpty((String)value)) {
> // if (statement == null) {
> // final String query = this.getSelectQuery(conf);
> // datasource = this.getDataSource(conf);
> // conn = datasource.getConnection();
> // statement = conn.prepareStatement(query);
> // currentIndex = 1;
> // for (int j = 0; j < keys.length; j++, currentIndex++) {
> // this.setColumn(statement, currentIndex, request, keys[j]);
> // }
> // rset = statement.executeQuery();
> // result = rset.next();
> // }
> // if (result) {
> // value = this.getColumn(rset, request, values[i]);
> // }
> // }
> // if (value != null) {
> // request.setAttribute(parameter, value.toString());
> // }
> // }
> // if(statement != null) {
> // statement.close();
> // }
> // return EMPTY_MAP;
> // } catch (Exception e) {
> // throw new ProcessingException("Could not prepare statement :position
> // = " + currentIndex, e);
> // } finally {
> // if (conn != null) {
> // try {
> // conn.close();
> // } catch (SQLException sqe) {
> // getLogger().warn("There was an error closing the datasource", sqe);
> // }
> // }
> // if (datasource != null) {
> // this.dbselector.release(datasource);
> // }
> // }
> //
> // // Result is empty map or exception. No null.
> String query = " select ID_Entity AS ID_Entity, ID_Field AS ID_Field, DataType AS DataType, Caption AS Caption , Mask AS Mask, DefaultValue AS DefaultValue, Mandatory AS Mandatory, ValueCheck AS ValueCheck , Enabled AS Enabled, Visible AS Visible, Range_Lower AS Range_Lower, Range_Upper AS Range_Upper , ValueCheck AS ValueCheck, Size AS Size , Icon AS Icon, Language AS Language FROM Field_Descriptions";
>
> // AmeliSelect.selectStatements.put(conf, query);
>
> Request request = ObjectModelHelper.getRequest(objectModel);
> Map map = new HashMap();
> DataSourceComponent dataSource = getDataSource("ameli_para_dev_datasource");
> Connection connection = null;
> try {
> connection = dataSource.getConnection();
> Statement statement = connection.createStatement();
> String cmd = query;
>
> ResultSet rs = statement.executeQuery(cmd);
> List list = constructResultFromResultSet(rs);
> Iterator iterator = list.iterator();
> // Converter.
> map.putAll((Map) list);
> statement.close();
>
> } catch (Exception e) {
> // TODO: handle exception
> // getLogger().error("Query failed: ", e);
> } finally {
> try {
> if (connection != null) {
> connection.close();
> }
> } catch (SQLException sqe) {
> // TODO: handle exception
> // getLogger().error("Error closing the datasource", sqe);
> }
>
> }
>
> return (map);
> }
>
> public void dispose() {
> this.manager.release(dbselector);
> }
>
> protected String getSelectQuery(Configuration conf)
> throws ConfigurationException {
> String query = null;
>
> // synchronized (AmeliSelect.selectStatements) {
> // query = (String)AmeliSelect.selectStatements.get(conf);
>
> // if (query == null) {
> // Configuration table = conf.getChild("table");
> // Configuration[] keys = table.getChild("keys").getChildren("key");
> // Configuration[] values =
> // table.getChild("values").getChildren("value");
> //
> // StringBuffer queryBuffer = new StringBuffer("SELECT ");
> // queryBuffer.append(buildList(keys, 0));
> // queryBuffer.append(buildList(values, keys.length));
> // queryBuffer.append(" FROM ");
> // queryBuffer.append(table.getAttribute("name"));
> //
> // queryBuffer.append(" WHERE ");
> // queryBuffer.append(buildList(keys, " AND "));
> // query = queryBuffer.toString();
> query = " select ID_Entity AS ID_Entity, ID_Field AS ID_Field, DataType AS DataType, Caption AS Caption , Mask AS Mask, DefaultValue AS DefaultValue, Mandatory AS Mandatory, ValueCheck AS ValueCheck , Enabled AS Enabled, Visible AS Visible, Range_Lower AS Range_Lower, Range_Upper AS Range_Upper , ValueCheck AS ValueCheck, Size AS Size , Icon AS Icon, Language AS Language FROM Field_Descriptions";
>
> // AmeliSelect.selectStatements.put(conf, query);
> // }
> // }
> // // return query;
> return null;
> }
>
> protected List constructResultFromResultSet(ResultSet rs)
> throws SQLException {
> ResultSetMetaData md = rs.getMetaData();
> int columnCount = md.getColumnCount();
> List results = new ArrayList();
> // save information in first row
> HashMap propInfo = new HashMap();
> for (int i = 0; i < columnCount; i++) {
> String columnName = md.getColumnName(i + 1);
> propInfo.put("column" + i, columnName);
> }
> Persistable pInfo = getNewPersistable();
> pInfo.setProperties(propInfo);
> results.add(pInfo);
> // get data from rs start from pos 1
> while ((rs != null) && (rs.next())) {
> HashMap props = new HashMap();
> for (int i = 0; i < columnCount; i++) {
> String columnName = md.getColumnName(i + 1);
> int type = md.getColumnType(i + 1);
> Object o = getValue(rs, type, i + 1);
> // if (debugSQL())
> // System.err.println(columnName + " = " + o);
> if (o != null) {
> props.put(columnName, o);
> } else {
> // props.put(columnName, "<null>");
> }
> }
> Persistable p = getNewPersistable();
> // if (debugSQL())
> // System.err.println("Setting properties with: " + props);
> // logger.debug("Setting properties with: " + props);
> p.setProperties(props);
> results.add(p);
> }
> return results;
> }
> protected Persistable getNewPersistable() {
> return new DefaultPersistable();
> }
> protected Object getValue(ResultSet rs, int type, int index) {
> // if (debugSQL())
> // System.err.println("COLUMN TYPE = " + type);
> // logger.debug("COLUMN TYPE = " + type);
>
> try {
>
> // handle the mysql TINYINT to Boolean Type
> if ((rs.toString().indexOf("mysql") > 0) && (type == Types.TINYINT))
> {
> // type for TinyBoolean in mysql !! not standard
> type = -1111;
> }
>
> if ((rs.toString().indexOf("microsoft") > 0) && (type == Types.FLOAT))
> {
> // type for Float in sqlserver !! not standard
> type = Types.DOUBLE;
> // System.out.println("type " + type);
> }
>
> Mapper m = getMapper(new Integer(type));
> if (m != null) {
> return m.getValue(rs, index);
> }
> } catch (Exception x) {
> // NULL values in the database cause most of the Mapper classes to
> // fail
> // a NULL value will result in the absence of this property from the
> // result.
> // if (debugSQL())
> // System.err.println(
> // "Warning: Unknown column type or NULL value for column " +
> // index);
> // logger.fatal(
> // "Warning: Unknown column type or NULL value for column "
> // + index, x);
> }
> return null;
> }
>
> protected Mapper getMapper(Object key) {
> if (mappers == null) {
> mappers = new HashMap();
> registerMapper(Byte.class, Types.TINYINT, new ByteMapper());
> DateMapper dm = new DateMapper();
> registerMapper(java.util.Date.class, Types.DATE, dm);
> // always convert sql Dates to util Dates from ResultSets
> registerMapper(java.sql.Date.class, 0, dm);
> registerMapper(Double.class, Types.DOUBLE, new DoubleMapper());
> registerMapper(Float.class, Types.FLOAT, new FloatMapper());
> registerMapper(Integer.class, Types.INTEGER, new IntMapper());
> registerMapper(java.math.BigDecimal.class, Types.NUMERIC,
> new NumericMapper());
> registerMapper(Long.class, Types.BIGINT, new LongMapper());
> registerMapper(Short.class, Types.SMALLINT, new ShortMapper());
> StringMapper strm = new StringMapper();
> registerMapper(String.class, Types.VARCHAR, strm);
> // mySQL return VARCHAR as CHAR
> registerMapper(String.class, Types.CHAR, strm);
> registerMapper(null, Types.LONGVARCHAR, strm);
> registerMapper(Time.class, Types.TIME, new TimeMapper());
> registerMapper(Timestamp.class, Types.TIMESTAMP,
> new TimestampMapper());
> // assume blob as string
> // mySQL return blob as LONGVARBINARY
> registerMapper(String.class, Types.BLOB, strm);
> registerMapper(String.class, Types.LONGVARBINARY, strm);
> // mySQL return tinyint as Boolean
> registerMapper(Boolean.class, -1111, new TinyBooleanMapper());
> // SQLServer return value
> registerMapper(Boolean.class, Types.BIT, new BooleanMapper());
> }
> return (Mapper) mappers.get(key);
> }
>
> public static void registerMapper(Class valueType, int sqlType,
> Mapper aMapper) {
> if (valueType != null)
> mappers.put(valueType, aMapper);
> if (sqlType != 0)
> mappers.put(new Integer(sqlType), aMapper);
> }
>
>
>
> public void actionPerformed(ActionEvent arg0) {
> // TODO Auto-generated method stub
>
> }
> }
>
>
> and my sitemap is:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
>
> <map:components>
> <map:actions>
> <map:action name="select" logger="sitemap.action.select"
> src="dbmanager.AmeliSelect"/>
> </map:actions>
> </map:components>
>
> <map:pipelines >
> <map:pipeline>
> <map:match pattern="/select">
> <map:act type="select">
> <!--map:generate type="file" src="content/ObjectionHTML.xml"/>
> <map:transform src="stylesheets/objection04.xslt"/-->
> <map:serialize type="html" />
> </map:act>
> </map:match>
> </map:pipeline>
> </map:pipelines>
>
> </map:sitemap>
>
> by http://localhost:8080/cocoon/amelidb/select i get Error:
>
>
> An error has occured
> java.lang.ClassCastException: $Proxy22
>
> Cocoon stacktrace[hide]
>
> Error while creating node 'act' at file:/E:/workspace3/cocoon-2.1.9/build/webapp/amelidb/sitemap.xmap:14:31 file:/E:/workspace3/cocoon-2.1.9/build/webapp/amelidb/sitemap.xmap - 14:31
>
> Failed to load sitemap from file:/E:/workspace3/cocoon-2.1.9/build/webapp/amelidb/sitemap.xmap file:/E:/workspace3/cocoon-2.1.9/build/webapp/amelidb/sitemap.xmap - 14:31 [ConfigurationException]
> file:/E:/workspace3/cocoon-2.1.9/build/webapp/sitemap.xmap - 947:66 <map:mount>
>
>
> Java stacktrace[show]
>
> java.lang.ClassCastException: $Proxy22
> at org.apache.cocoon.components.treeprocessor.sitemap.ActTypeNode.compose(ActTypeNode.java:80)
> at org.apache.cocoon.components.LifecycleHelper.setupComponent(LifecycleHelper.java:359)
> at org.apache.cocoon.components.LifecycleHelper.setupComponent(LifecycleHelper.java:195)
> at org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder.setupNode(DefaultTreeBuilder.java:455)
> at org.apache.cocoon.components.treeprocessor.sitemap.ActNodeBuilder.buildNode(ActNodeBuilder.java:69)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNodeBuilder.buildChildNodesList(AbstractParentProcessingNodeBuilder.java:121)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNodeBuilder.buildChildNodes(AbstractParentProcessingNodeBuilder.java:136)
> at org.apache.cocoon.components.treeprocessor.sitemap.MatchNodeBuilder.buildNode(MatchNodeBuilder.java:77)
> at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNodeBuilder.buildNode(PipelineNodeBuilder.java:110)
> at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNodeBuilder.buildNode(PipelinesNodeBuilder.java:63)
> at org.apache.cocoon.components.treeprocessor.sitemap.SitemapNodeBuilder.buildNode(SitemapNodeBuilder.java:70)
> at org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder.createTree(DefaultTreeBuilder.java:334)
> at org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder.build(DefaultTreeBuilder.java:407)
> at org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder.build(DefaultTreeBuilder.java:369)
> at org.apache.cocoon.components.treeprocessor.TreeProcessor.buildConcreteProcessor(TreeProcessor.java:339)
> at org.apache.cocoon.components.treeprocessor.TreeProcessor.setupConcreteProcessor(TreeProcessor.java:304)
> at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:250)
> at org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:117)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
> at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
> at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:142)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
> at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:92)
> at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:234)
> at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:176)
> at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:252)
> at org.apache.cocoon.Cocoon.process(Cocoon.java:686)
> at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1153)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
> at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
> at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> at java.lang.Thread.run(Unknown Source)
>
> Java full stacktrace[show]
>
> org.apache.cocoon.ProcessingException: Failed to load sitemap from file:/E:/workspace3/cocoon-2.1.9/build/webapp/amelidb/sitemap.xmap
> at [ConfigurationException] - file:/E:/workspace3/cocoon-2.1.9/build/webapp/amelidb/sitemap.xmap:14:31
> at <map:mount> - file:/E:/workspace3/cocoon-2.1.9/build/webapp/sitemap.xmap:947:66
> at org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder.build(DefaultTreeBuilder.java:373)
> at org.apache.cocoon.components.treeprocessor.TreeProcessor.buildConcreteProcessor(TreeProcessor.java:339)
> at org.apache.cocoon.components.treeprocessor.TreeProcessor.setupConcreteProcessor(TreeProcessor.java:304)
> at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:250)
> at org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:117)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
> at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
> at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:142)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
> at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:92)
> at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:234)
> at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:176)
> at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:252)
> at org.apache.cocoon.Cocoon.process(Cocoon.java:686)
> at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1153)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
> at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
> at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> at java.lang.Thread.run(Unknown Source)
> Caused by: org.apache.avalon.framework.configuration.ConfigurationException: Error while creating node 'act' at file:/E:/workspace3/cocoon-2.1.9/build/webapp/amelidb/sitemap.xmap:14:31
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNodeBuilder.buildChildNodesList(AbstractParentProcessingNodeBuilder.java:128)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNodeBuilder.buildChildNodes(AbstractParentProcessingNodeBuilder.java:136)
> at org.apache.cocoon.components.treeprocessor.sitemap.MatchNodeBuilder.buildNode(MatchNodeBuilder.java:77)
> at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNodeBuilder.buildNode(PipelineNodeBuilder.java:110)
> at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNodeBuilder.buildNode(PipelinesNodeBuilder.java:63)
> at org.apache.cocoon.components.treeprocessor.sitemap.SitemapNodeBuilder.buildNode(SitemapNodeBuilder.java:70)
> at org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder.createTree(DefaultTreeBuilder.java:334)
> at org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder.build(DefaultTreeBuilder.java:407)
> at org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder.build(DefaultTreeBuilder.java:369)
> ... 30 more
> Caused by: java.lang.ClassCastException: $Proxy22
> at org.apache.cocoon.components.treeprocessor.sitemap.ActTypeNode.compose(ActTypeNode.java:80)
> at org.apache.cocoon.components.LifecycleHelper.setupComponent(LifecycleHelper.java:359)
> at org.apache.cocoon.components.LifecycleHelper.setupComponent(LifecycleHelper.java:195)
> at org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder.setupNode(DefaultTreeBuilder.java:455)
> at org.apache.cocoon.components.treeprocessor.sitemap.ActNodeBuilder.buildNode(ActNodeBuilder.java:69)
> at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNodeBuilder.buildChildNodesList(AbstractParentProcessingNodeBuilder.java:121)
> ... 38 more
>
> The Apache Cocoon Project
>
> i need your help!!!!
>
--
F&F Computer Anwendungen Tel: +49 89 51727-312
und Unternehmensberatung GmbH Fax: +49 89 51727-111
Westendstr. 195 Mail: r.seidl@ff-muenchen.de
D-80686 Muenchen http://www.ff-muenchen.de
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Action Database Problem
Posted by rachid harradi <ra...@gmx.net>.
Hello,
my AmeliSele "class" is:
package dbmanager;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
import java.sql.Types;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.swing.AbstractAction;
import org.apache.avalon.excalibur.datasource.DataSourceComponent;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.ComponentSelector;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.Constants;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.acting.AbstractDatabaseAction;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Redirector;
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.environment.SourceResolver;
import org.apache.commons.lang.StringUtils;
import org.xml.sax.InputSource;
import cuba.ComponentException;
public class AmeliSelect extends AbstractAction implements ThreadSafe, Composable, Disposable {
// private static final Map selectStatements = new HashMap();
// private DBManager dbm = null;
// private ServiceManager manager = null;
// private InputSource inputSource = null;
// DataSourceComponent datasource = null;
protected ComponentSelector dbselector;
protected ComponentManager manager;
private static HashMap mappers = null;
// public void service(ServiceManager serviceManager) throws
// ServiceException {
// System.out.println("[User.java | service] beginn");
// this.manager = serviceManager;
//
// }
public void compose(ComponentManager manager) throws org.apache.avalon.framework.component.ComponentException {
// TODO Auto-generated method stub
this.dbselector = (ComponentSelector) manager
.lookup(DataSourceComponent.ROLE + "Selector");
}
// public void compose()
// throws org.apache.avalon.framework.component.ComponentException {
// this.dbselector = (ComponentSelector) manager
// .lookup(DataSourceComponent.ROLE + "Selector");
// }
protected final DataSourceComponent getDataSource(String pool)
throws org.apache.avalon.framework.component.ComponentException {
return (DataSourceComponent) this.dbselector.select(pool);
}
public Map act(Redirector redirector, SourceResolver resolver,
Map objectModel, String source, Parameters param) throws Exception {
// DataSourceComponent datasource = null;
// Connection conn = null;
// int currentIndex = 0;
//
// // read global parameter settings
// boolean reloadable = Constants.DESCRIPTOR_RELOADABLE_DEFAULT;
// if (this.settings.containsKey("reloadable"))
// reloadable = Boolean.valueOf((String)
// this.settings.get("reloadable")).booleanValue();
// // read local parameter settings
// try {
// Configuration conf =
// this.getConfiguration(param.getParameter("descriptor", (String)
// this.settings.get("descriptor")),
// resolver,
// param.getParameterAsBoolean("reloadable",reloadable));
//
// Request request = ObjectModelHelper.getRequest(objectModel);
//
// Configuration[] keys =
// conf.getChild("table").getChild("keys").getChildren("key");
// Configuration[] values =
// conf.getChild("table").getChild("values").getChildren("value");
//
// PreparedStatement statement = null;
// ResultSet rset = null;
// boolean result = false;
//
// for (int i = 0; i < keys.length; i++) {
// final String parameter = keys[i].getAttribute("param");
// Object value = request.getParameter(parameter);
// if (StringUtils.isEmpty((String)value)) {
// if (statement == null) {
// final String query = this.getSelectQuery(conf);
// System.out.println("[User.java | User] pre");
// this.dbm = (DBManager) this.manager.lookup(DBManager.ROLE);
// System.out.println("[User.java | User] middle");
// datasource = this.dbm.getDsc();
// conn = datasource.getConnection();
//
// statement = conn.prepareStatement(query);
// currentIndex = 1;
// for (int j = 0; j < keys.length; j++, currentIndex++) {
// this.setColumn(statement, currentIndex, request, keys[j]);
// }
// rset = statement.executeQuery();
// result = rset.next();
// }
// if (result) {
// value = this.getColumn(rset, request, keys[i]);
// }
// }
// if (value != null) {
// request.setAttribute(parameter, value.toString());
// }
// }
//
// for (int i = 0; i < values.length; i++) {
// final String parameter = values[i].getAttribute("param");
// Object value = request.getParameter(parameter);
// if (StringUtils.isEmpty((String)value)) {
// if (statement == null) {
// final String query = this.getSelectQuery(conf);
// datasource = this.getDataSource(conf);
// conn = datasource.getConnection();
// statement = conn.prepareStatement(query);
// currentIndex = 1;
// for (int j = 0; j < keys.length; j++, currentIndex++) {
// this.setColumn(statement, currentIndex, request, keys[j]);
// }
// rset = statement.executeQuery();
// result = rset.next();
// }
// if (result) {
// value = this.getColumn(rset, request, values[i]);
// }
// }
// if (value != null) {
// request.setAttribute(parameter, value.toString());
// }
// }
// if(statement != null) {
// statement.close();
// }
// return EMPTY_MAP;
// } catch (Exception e) {
// throw new ProcessingException("Could not prepare statement :position
// = " + currentIndex, e);
// } finally {
// if (conn != null) {
// try {
// conn.close();
// } catch (SQLException sqe) {
// getLogger().warn("There was an error closing the datasource", sqe);
// }
// }
// if (datasource != null) {
// this.dbselector.release(datasource);
// }
// }
//
// // Result is empty map or exception. No null.
String query = " select ID_Entity AS ID_Entity, ID_Field AS ID_Field, DataType AS DataType, Caption AS Caption , Mask AS Mask, DefaultValue AS DefaultValue, Mandatory AS Mandatory, ValueCheck AS ValueCheck , Enabled AS Enabled, Visible AS Visible, Range_Lower AS Range_Lower, Range_Upper AS Range_Upper , ValueCheck AS ValueCheck, Size AS Size , Icon AS Icon, Language AS Language FROM Field_Descriptions";
// AmeliSelect.selectStatements.put(conf, query);
Request request = ObjectModelHelper.getRequest(objectModel);
Map map = new HashMap();
DataSourceComponent dataSource = getDataSource("ameli_para_dev_datasource");
Connection connection = null;
try {
connection = dataSource.getConnection();
Statement statement = connection.createStatement();
String cmd = query;
ResultSet rs = statement.executeQuery(cmd);
List list = constructResultFromResultSet(rs);
Iterator iterator = list.iterator();
// Converter.
map.putAll((Map) list);
statement.close();
} catch (Exception e) {
// TODO: handle exception
// getLogger().error("Query failed: ", e);
} finally {
try {
if (connection != null) {
connection.close();
}
} catch (SQLException sqe) {
// TODO: handle exception
// getLogger().error("Error closing the datasource", sqe);
}
}
return (map);
}
public void dispose() {
this.manager.release(dbselector);
}
protected String getSelectQuery(Configuration conf)
throws ConfigurationException {
String query = null;
// synchronized (AmeliSelect.selectStatements) {
// query = (String)AmeliSelect.selectStatements.get(conf);
// if (query == null) {
// Configuration table = conf.getChild("table");
// Configuration[] keys = table.getChild("keys").getChildren("key");
// Configuration[] values =
// table.getChild("values").getChildren("value");
//
// StringBuffer queryBuffer = new StringBuffer("SELECT ");
// queryBuffer.append(buildList(keys, 0));
// queryBuffer.append(buildList(values, keys.length));
// queryBuffer.append(" FROM ");
// queryBuffer.append(table.getAttribute("name"));
//
// queryBuffer.append(" WHERE ");
// queryBuffer.append(buildList(keys, " AND "));
// query = queryBuffer.toString();
query = " select ID_Entity AS ID_Entity, ID_Field AS ID_Field, DataType AS DataType, Caption AS Caption , Mask AS Mask, DefaultValue AS DefaultValue, Mandatory AS Mandatory, ValueCheck AS ValueCheck , Enabled AS Enabled, Visible AS Visible, Range_Lower AS Range_Lower, Range_Upper AS Range_Upper , ValueCheck AS ValueCheck, Size AS Size , Icon AS Icon, Language AS Language FROM Field_Descriptions";
// AmeliSelect.selectStatements.put(conf, query);
// }
// }
// // return query;
return null;
}
protected List constructResultFromResultSet(ResultSet rs)
throws SQLException {
ResultSetMetaData md = rs.getMetaData();
int columnCount = md.getColumnCount();
List results = new ArrayList();
// save information in first row
HashMap propInfo = new HashMap();
for (int i = 0; i < columnCount; i++) {
String columnName = md.getColumnName(i + 1);
propInfo.put("column" + i, columnName);
}
Persistable pInfo = getNewPersistable();
pInfo.setProperties(propInfo);
results.add(pInfo);
// get data from rs start from pos 1
while ((rs != null) && (rs.next())) {
HashMap props = new HashMap();
for (int i = 0; i < columnCount; i++) {
String columnName = md.getColumnName(i + 1);
int type = md.getColumnType(i + 1);
Object o = getValue(rs, type, i + 1);
// if (debugSQL())
// System.err.println(columnName + " = " + o);
if (o != null) {
props.put(columnName, o);
} else {
// props.put(columnName, "<null>");
}
}
Persistable p = getNewPersistable();
// if (debugSQL())
// System.err.println("Setting properties with: " + props);
// logger.debug("Setting properties with: " + props);
p.setProperties(props);
results.add(p);
}
return results;
}
protected Persistable getNewPersistable() {
return new DefaultPersistable();
}
protected Object getValue(ResultSet rs, int type, int index) {
// if (debugSQL())
// System.err.println("COLUMN TYPE = " + type);
// logger.debug("COLUMN TYPE = " + type);
try {
// handle the mysql TINYINT to Boolean Type
if ((rs.toString().indexOf("mysql") > 0) && (type == Types.TINYINT))
{
// type for TinyBoolean in mysql !! not standard
type = -1111;
}
if ((rs.toString().indexOf("microsoft") > 0) && (type == Types.FLOAT))
{
// type for Float in sqlserver !! not standard
type = Types.DOUBLE;
// System.out.println("type " + type);
}
Mapper m = getMapper(new Integer(type));
if (m != null) {
return m.getValue(rs, index);
}
} catch (Exception x) {
// NULL values in the database cause most of the Mapper classes to
// fail
// a NULL value will result in the absence of this property from the
// result.
// if (debugSQL())
// System.err.println(
// "Warning: Unknown column type or NULL value for column " +
// index);
// logger.fatal(
// "Warning: Unknown column type or NULL value for column "
// + index, x);
}
return null;
}
protected Mapper getMapper(Object key) {
if (mappers == null) {
mappers = new HashMap();
registerMapper(Byte.class, Types.TINYINT, new ByteMapper());
DateMapper dm = new DateMapper();
registerMapper(java.util.Date.class, Types.DATE, dm);
// always convert sql Dates to util Dates from ResultSets
registerMapper(java.sql.Date.class, 0, dm);
registerMapper(Double.class, Types.DOUBLE, new DoubleMapper());
registerMapper(Float.class, Types.FLOAT, new FloatMapper());
registerMapper(Integer.class, Types.INTEGER, new IntMapper());
registerMapper(java.math.BigDecimal.class, Types.NUMERIC,
new NumericMapper());
registerMapper(Long.class, Types.BIGINT, new LongMapper());
registerMapper(Short.class, Types.SMALLINT, new ShortMapper());
StringMapper strm = new StringMapper();
registerMapper(String.class, Types.VARCHAR, strm);
// mySQL return VARCHAR as CHAR
registerMapper(String.class, Types.CHAR, strm);
registerMapper(null, Types.LONGVARCHAR, strm);
registerMapper(Time.class, Types.TIME, new TimeMapper());
registerMapper(Timestamp.class, Types.TIMESTAMP,
new TimestampMapper());
// assume blob as string
// mySQL return blob as LONGVARBINARY
registerMapper(String.class, Types.BLOB, strm);
registerMapper(String.class, Types.LONGVARBINARY, strm);
// mySQL return tinyint as Boolean
registerMapper(Boolean.class, -1111, new TinyBooleanMapper());
// SQLServer return value
registerMapper(Boolean.class, Types.BIT, new BooleanMapper());
}
return (Mapper) mappers.get(key);
}
public static void registerMapper(Class valueType, int sqlType,
Mapper aMapper) {
if (valueType != null)
mappers.put(valueType, aMapper);
if (sqlType != 0)
mappers.put(new Integer(sqlType), aMapper);
}
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
}
}
and my sitemap is:
<?xml version="1.0" encoding="UTF-8"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:components>
<map:actions>
<map:action name="select" logger="sitemap.action.select"
src="dbmanager.AmeliSelect"/>
</map:actions>
</map:components>
<map:pipelines >
<map:pipeline>
<map:match pattern="/select">
<map:act type="select">
<!--map:generate type="file" src="content/ObjectionHTML.xml"/>
<map:transform src="stylesheets/objection04.xslt"/-->
<map:serialize type="html" />
</map:act>
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>
by http://localhost:8080/cocoon/amelidb/select i get Error:
An error has occured
java.lang.ClassCastException: $Proxy22
Cocoon stacktrace[hide]
Error while creating node 'act' at file:/E:/workspace3/cocoon-2.1.9/build/webapp/amelidb/sitemap.xmap:14:31 file:/E:/workspace3/cocoon-2.1.9/build/webapp/amelidb/sitemap.xmap - 14:31
Failed to load sitemap from file:/E:/workspace3/cocoon-2.1.9/build/webapp/amelidb/sitemap.xmap file:/E:/workspace3/cocoon-2.1.9/build/webapp/amelidb/sitemap.xmap - 14:31 [ConfigurationException]
file:/E:/workspace3/cocoon-2.1.9/build/webapp/sitemap.xmap - 947:66 <map:mount>
Java stacktrace[show]
java.lang.ClassCastException: $Proxy22
at org.apache.cocoon.components.treeprocessor.sitemap.ActTypeNode.compose(ActTypeNode.java:80)
at org.apache.cocoon.components.LifecycleHelper.setupComponent(LifecycleHelper.java:359)
at org.apache.cocoon.components.LifecycleHelper.setupComponent(LifecycleHelper.java:195)
at org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder.setupNode(DefaultTreeBuilder.java:455)
at org.apache.cocoon.components.treeprocessor.sitemap.ActNodeBuilder.buildNode(ActNodeBuilder.java:69)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNodeBuilder.buildChildNodesList(AbstractParentProcessingNodeBuilder.java:121)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNodeBuilder.buildChildNodes(AbstractParentProcessingNodeBuilder.java:136)
at org.apache.cocoon.components.treeprocessor.sitemap.MatchNodeBuilder.buildNode(MatchNodeBuilder.java:77)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNodeBuilder.buildNode(PipelineNodeBuilder.java:110)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNodeBuilder.buildNode(PipelinesNodeBuilder.java:63)
at org.apache.cocoon.components.treeprocessor.sitemap.SitemapNodeBuilder.buildNode(SitemapNodeBuilder.java:70)
at org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder.createTree(DefaultTreeBuilder.java:334)
at org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder.build(DefaultTreeBuilder.java:407)
at org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder.build(DefaultTreeBuilder.java:369)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.buildConcreteProcessor(TreeProcessor.java:339)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.setupConcreteProcessor(TreeProcessor.java:304)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:250)
at org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:117)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:142)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:92)
at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:234)
at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:176)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:252)
at org.apache.cocoon.Cocoon.process(Cocoon.java:686)
at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1153)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
Java full stacktrace[show]
org.apache.cocoon.ProcessingException: Failed to load sitemap from file:/E:/workspace3/cocoon-2.1.9/build/webapp/amelidb/sitemap.xmap
at [ConfigurationException] - file:/E:/workspace3/cocoon-2.1.9/build/webapp/amelidb/sitemap.xmap:14:31
at <map:mount> - file:/E:/workspace3/cocoon-2.1.9/build/webapp/sitemap.xmap:947:66
at org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder.build(DefaultTreeBuilder.java:373)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.buildConcreteProcessor(TreeProcessor.java:339)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.setupConcreteProcessor(TreeProcessor.java:304)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:250)
at org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:117)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:142)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:92)
at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:234)
at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:176)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:252)
at org.apache.cocoon.Cocoon.process(Cocoon.java:686)
at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1153)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.avalon.framework.configuration.ConfigurationException: Error while creating node 'act' at file:/E:/workspace3/cocoon-2.1.9/build/webapp/amelidb/sitemap.xmap:14:31
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNodeBuilder.buildChildNodesList(AbstractParentProcessingNodeBuilder.java:128)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNodeBuilder.buildChildNodes(AbstractParentProcessingNodeBuilder.java:136)
at org.apache.cocoon.components.treeprocessor.sitemap.MatchNodeBuilder.buildNode(MatchNodeBuilder.java:77)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNodeBuilder.buildNode(PipelineNodeBuilder.java:110)
at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNodeBuilder.buildNode(PipelinesNodeBuilder.java:63)
at org.apache.cocoon.components.treeprocessor.sitemap.SitemapNodeBuilder.buildNode(SitemapNodeBuilder.java:70)
at org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder.createTree(DefaultTreeBuilder.java:334)
at org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder.build(DefaultTreeBuilder.java:407)
at org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder.build(DefaultTreeBuilder.java:369)
... 30 more
Caused by: java.lang.ClassCastException: $Proxy22
at org.apache.cocoon.components.treeprocessor.sitemap.ActTypeNode.compose(ActTypeNode.java:80)
at org.apache.cocoon.components.LifecycleHelper.setupComponent(LifecycleHelper.java:359)
at org.apache.cocoon.components.LifecycleHelper.setupComponent(LifecycleHelper.java:195)
at org.apache.cocoon.components.treeprocessor.DefaultTreeBuilder.setupNode(DefaultTreeBuilder.java:455)
at org.apache.cocoon.components.treeprocessor.sitemap.ActNodeBuilder.buildNode(ActNodeBuilder.java:69)
at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNodeBuilder.buildChildNodesList(AbstractParentProcessingNodeBuilder.java:121)
... 38 more
The Apache Cocoon Project
i need your help!!!!
--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: Ajax forms can't handle unicode?
Posted by "Binkley, Peter" <Pe...@ualberta.ca>.
The field contents are being encoded the same when I use Ajax and when I don't, but now that I look at it there is a problem with the Content-Type http header. When I call an Ajax form, I get a correctly encoded html page with "Content-Type: text/html; charset=iso-8859-1". When I submit the form, I see two POSTs: the first one sends up all the form fields, with accented characters correctly encoded, and with the correct content type (with charset=UTF-8); the second one just sends these fields: "cocoon-ajax-continue=true&continuation-id=414b635f2177361e701818864f19476722597279", and it has only "Content-Type: application/x-www-form-urlencoded" - no charset.
The first POST is presumably an xmlhttprequest; it returns a block of xml like this:
<?xml version='1.0'?><bu:document xmlns:bu='http://apache.org/cocoon/browser-update/1.0'><bu:continue/></bu:document>
The second POST is presumably the actual form submission, and it returns the HTML of the upload-success page. So it appears that the xmlhttprequest is using the correct charset, but the actual form submission is not using the charset of the html page in which the form was found.
But if I turn Ajax off, I get only one POST (of course), in which the accented characters are encoded properly but there is no "charset=UTF-8" in the content type header, even though there was in the response header for the html page.
So: it appears that when ajax is turned off, my use of the form-encoding action is forcing the field contents to be interpreted as UTF-8 even though Firefox isn't specifying their encoding in the content type header; but when ajax is turned on, Cocoon is interpreting them as ISO-8859-1 even though the content type header and the form-encoding action both say they are UTF-8.
It's possible I've got something weird in my configuration left over from the conversion process from 2.1.7 to 2.1.9. I'll try to create a simple test case that shows the problem based on the samples.
Peter
________________________________
From: Jonas Lundberg [mailto:my.name.is.hans@gmail.com]
Sent: Thu 8/31/2006 8:04 AM
To: users@cocoon.apache.org
Subject: Re: Ajax forms can't handle unicode?
It can happen that the web browser either does not support UTF-8 for
Ajax calls, or that you have not set the Ajax call to accept UTF-8 (In
Firefox, for instance, I have not been able to set the actual encoding
for Ajax calls, although it might be possible) (Note that setting the
actual encoding is different from using an encoding description
request header.)
The easiest way, if you want a fix, is to use an encode-uri function
on the server and in the ajax javascript, then the transfer encoding
will not matter.
Regards
Hans
On 8/30/06, Binkley, Peter <Pe...@ualberta.ca> wrote:
> I'm updating an old Cforms project from 2.1.7 to 2.1.9 and adding Ajax.
> The setup is similar to the form1.flow sample, where the uploaded form
> is sent to a pipeline that starts with a jx template. I've set things up
> so form fields are interpreted as UTF-8. Everything works under 2.1.9 if
> I don't turn Ajax on (with "ajax=true" in the form template). If I do
> turn ajax on, though, any accented characters I type into a form field
> end up as question marks in the output. It appears that turning ajax on
> causes the form handling to be done in ISO-8859-1 instead of UTF-8. Has
> anyone else seen this, and is there a known fix?
>
> Thanks,
>
> Peter
>
>
> Peter Binkley
> Digital Initiatives Technology Librarian
> Information Technology Services
> 4-30 Cameron Library
> University of Alberta Libraries
> Edmonton, Alberta
> Canada T6G 2J8
> Phone: (780) 492-3743
> Fax: (780) 492-9243
> e-mail: peter.binkley@ualberta.ca
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Ajax forms can't handle unicode?
Posted by Jonas Lundberg <my...@gmail.com>.
It can happen that the web browser either does not support UTF-8 for
Ajax calls, or that you have not set the Ajax call to accept UTF-8 (In
Firefox, for instance, I have not been able to set the actual encoding
for Ajax calls, although it might be possible) (Note that setting the
actual encoding is different from using an encoding description
request header.)
The easiest way, if you want a fix, is to use an encode-uri function
on the server and in the ajax javascript, then the transfer encoding
will not matter.
Regards
Hans
On 8/30/06, Binkley, Peter <Pe...@ualberta.ca> wrote:
> I'm updating an old Cforms project from 2.1.7 to 2.1.9 and adding Ajax.
> The setup is similar to the form1.flow sample, where the uploaded form
> is sent to a pipeline that starts with a jx template. I've set things up
> so form fields are interpreted as UTF-8. Everything works under 2.1.9 if
> I don't turn Ajax on (with "ajax=true" in the form template). If I do
> turn ajax on, though, any accented characters I type into a form field
> end up as question marks in the output. It appears that turning ajax on
> causes the form handling to be done in ISO-8859-1 instead of UTF-8. Has
> anyone else seen this, and is there a known fix?
>
> Thanks,
>
> Peter
>
>
> Peter Binkley
> Digital Initiatives Technology Librarian
> Information Technology Services
> 4-30 Cameron Library
> University of Alberta Libraries
> Edmonton, Alberta
> Canada T6G 2J8
> Phone: (780) 492-3743
> Fax: (780) 492-9243
> e-mail: peter.binkley@ualberta.ca
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Ajax forms can't handle unicode?
Posted by Bertrand Delacretaz <bd...@apache.org>.
On 8/30/06, Binkley, Peter <Pe...@ualberta.ca> wrote:
> ...It appears that turning ajax on
> causes the form handling to be done in ISO-8859-1 instead of UTF-8...
Are you also sending your pages with UTF-8 encoding? If not, the
browser might be using another encoding to submit, see [1]. You can
configure the encoding in the sitemap's serializer declaration.
-Bertrand
[1] http://www.intertwingly.net/blog/2004/04/15/Character-Encoding-and-HTML-Forms
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Ajax forms can't handle unicode?
Posted by "Binkley, Peter" <Pe...@ualberta.ca>.
I'm updating an old Cforms project from 2.1.7 to 2.1.9 and adding Ajax.
The setup is similar to the form1.flow sample, where the uploaded form
is sent to a pipeline that starts with a jx template. I've set things up
so form fields are interpreted as UTF-8. Everything works under 2.1.9 if
I don't turn Ajax on (with "ajax=true" in the form template). If I do
turn ajax on, though, any accented characters I type into a form field
end up as question marks in the output. It appears that turning ajax on
causes the form handling to be done in ISO-8859-1 instead of UTF-8. Has
anyone else seen this, and is there a known fix?
Thanks,
Peter
Peter Binkley
Digital Initiatives Technology Librarian
Information Technology Services
4-30 Cameron Library
University of Alberta Libraries
Edmonton, Alberta
Canada T6G 2J8
Phone: (780) 492-3743
Fax: (780) 492-9243
e-mail: peter.binkley@ualberta.ca
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
AW: CForm Definition and CForm Template issue
Posted by Christofer Dutz <du...@c-ware.de>.
Hi Omar,
I think you should use lookupWidget instead of getChild. getChild only gets
you the direct child of the form-root. You could either write
form.getChild("name").getChild("firstname").getValue();
Or
form.lookupWidget("name/firstname").getValue();
Hope this helps.
Regards,
Chris
[ c h r i s t o f e r d u t z ]
IT-Berater
univativ GmbH & Co. KG
Robert-Bosch-Str. 7, 64293 Darmstadt
fon: 0 61 51 / 66 717 - 21
fax: 0 61 51 / 66 717 - 29
email: christofer.dutz@univativ.de
http://www.univativ.de
Darmstadt, Stuttgart, Karlsruhe, Düsseldorf
-----Ursprüngliche Nachricht-----
Von: Omar Adobati [mailto:omar.adobati@gmail.com]
Gesendet: Mittwoch, 30. August 2006 09:39
An: users@cocoon.apache.org
Betreff: Re: CForm Definition and CForm Template issue
Actually, with the suggestions retrieved by the ML the form is well
displayed but... it doesn't work when I try to submit it. I have back
an error that says:
org.mozilla.javascript.EcmaError: Cannot convert null to an object.
and it refers to the line of code in the javascript file:
"firstname" : form.getChild("firstname").getValue(),
"lastname" : form.getChild("lastname").getValue(),
I think it's about the group tags I use, but I also think that should
be a way to do this job modifying the code in the flow script file...
where I can find a reference? Does anyone could help me again?
Thanks a lot
Omar
On 8/29/06, Mark Lundquist <ml...@wrinkledog.com> wrote:
>
> On Aug 29, 2006, at 7:50 AM, Omar Adobati wrote:
>
> > Do I need a <fd:widgets> for each <fd:field> or I could have just one
> > <fd:widgets> for each <fd:group> tag?
>
> Just one. I think it _has_ to be that way.
> ml
--
Dr. Omar Adobati
omar.adobati@gmail.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: CForm Definition and CForm Template issue
Posted by Omar Adobati <om...@gmail.com>.
Actually, with the suggestions retrieved by the ML the form is well
displayed but... it doesn't work when I try to submit it. I have back
an error that says:
org.mozilla.javascript.EcmaError: Cannot convert null to an object.
and it refers to the line of code in the javascript file:
"firstname" : form.getChild("firstname").getValue(),
"lastname" : form.getChild("lastname").getValue(),
I think it's about the group tags I use, but I also think that should
be a way to do this job modifying the code in the flow script file...
where I can find a reference? Does anyone could help me again?
Thanks a lot
Omar
On 8/29/06, Mark Lundquist <ml...@wrinkledog.com> wrote:
>
> On Aug 29, 2006, at 7:50 AM, Omar Adobati wrote:
>
> > Do I need a <fd:widgets> for each <fd:field> or I could have just one
> > <fd:widgets> for each <fd:group> tag?
>
> Just one. I think it _has_ to be that way.
> —ml—
--
Dr. Omar Adobati
omar.adobati@gmail.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: CForm Definition and CForm Template issue
Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Aug 29, 2006, at 7:50 AM, Omar Adobati wrote:
> Do I need a <fd:widgets> for each <fd:field> or I could have just one
> <fd:widgets> for each <fd:group> tag?
Just one. I think it _has_ to be that way.
—ml—
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: CForm Definition and CForm Template issue
Posted by Omar Adobati <om...@gmail.com>.
Do I need a <fd:widgets> for each <fd:field> or I could have just one
<fd:widgets> for each <fd:group> tag?
thanks again a lot,
Omar
On 8/29/06, Jason Johnston <co...@lojjic.net> wrote:
> Omar Adobati wrote:
> > Jason,
> >
> > I tried your solution but it won't work... here is my form definition
> > snippet, there's any mistake?
> >
> > <fd:group id="name">
> > <fd:field id="firstname" required="true">
> > <fd:label>Nome</fd:label>
> > <fd:help>First name of the sender of the message</fd:help>
> > <fd:datatype base="string"/>
> > <fd:validation>
> > <fd:length min="2"/>
> > </fd:validation>
> > </fd:field>
> >
> > <fd:field id="lastname" required="true">
> > <fd:label>Cognome</fd:label>
> > <fd:help>Last name of the sender of the message</fd:help>
> > <fd:datatype base="string"/>
> > <fd:validation>
> > <fd:length min="2"/>
> > </fd:validation>
> > </fd:field>
> > </fd:group>
> >
>
> Ah, didn't notice before... but you have to wrap the fd:field's within
> an fd:widgets element, they cannot be direct children of fd:group.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
--
Dr. Omar Adobati
omar.adobati@gmail.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: CForm Definition and CForm Template issue
Posted by Jason Johnston <co...@lojjic.net>.
Omar Adobati wrote:
> Jason,
>
> I tried your solution but it won't work... here is my form definition
> snippet, there's any mistake?
>
> <fd:group id="name">
> <fd:field id="firstname" required="true">
> <fd:label>Nome</fd:label>
> <fd:help>First name of the sender of the message</fd:help>
> <fd:datatype base="string"/>
> <fd:validation>
> <fd:length min="2"/>
> </fd:validation>
> </fd:field>
>
> <fd:field id="lastname" required="true">
> <fd:label>Cognome</fd:label>
> <fd:help>Last name of the sender of the message</fd:help>
> <fd:datatype base="string"/>
> <fd:validation>
> <fd:length min="2"/>
> </fd:validation>
> </fd:field>
> </fd:group>
>
Ah, didn't notice before... but you have to wrap the fd:field's within
an fd:widgets element, they cannot be direct children of fd:group.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: CForm Definition and CForm Template issue
Posted by Omar Adobati <om...@gmail.com>.
Jason,
I tried your solution but it won't work... here is my form definition
snippet, there's any mistake?
<fd:group id="name">
<fd:field id="firstname" required="true">
<fd:label>Nome</fd:label>
<fd:help>First name of the sender of the message</fd:help>
<fd:datatype base="string"/>
<fd:validation>
<fd:length min="2"/>
</fd:validation>
</fd:field>
<fd:field id="lastname" required="true">
<fd:label>Cognome</fd:label>
<fd:help>Last name of the sender of the message</fd:help>
<fd:datatype base="string"/>
<fd:validation>
<fd:length min="2"/>
</fd:validation>
</fd:field>
</fd:group>
thank you very much,
Omar
On 8/29/06, Jason Johnston <co...@lojjic.net> wrote:
> Omar Adobati wrote:
> > Good Morning, here is a snippet of code I'm trying to use:
> >
> > == form definition ==
> >
> > <fd:group id="name">
> > <fd:field id="firstname" required="true">
> > <fd:label>Nome</fd:label>
> > <fd:help>First name of the sender of the message</fd:help>
> > <fd:datatype base="string"/>
> > <fd:validation>
> > <fd:length min="2"/>
> > </fd:validation>
> > </fd:field>
> >
> > <fd:field id="lastname" required="true">
> > <fd:label>Cognome</fd:label>
> > <fd:help>Last name of the sender of the message</fd:help>
> > <fd:datatype base="string"/>
> > <fd:validation>
> > <fd:length min="2"/>
> > </fd:validation>
> > </fd:field>
> > </fd:group>
> >
> > == form template ==
> >
> > <ft:form-template action="#{$continuation/id}.continue" method="POST">
> > <fi:group>
> > <fi:styling layout="columns"/>
> > <fi:items>
> > <ft:widget id="firstname"/>
> > <ft:widget id="lastname"/>
> > </fi:items>
> > </fi:group>
> > <input type="submit"/>
> > </ft:form-template>
>
> The nested structure of the "ft:" elements has to match that of the
> "fd:" elements. So you need the two ft:widget elements to be wrapped
> by an <ft:group id="name">...</ft:group>.
>
> Note that the ft:group element is currently just a marker for conveying
> the form structure, and doesn't produce any output of its own. So
> you'll still need the fi:group to be there, though it may look redundant
> at first glance.
>
> <ft:form-template action="#{$continuation/id}.continue" method="POST">
> <ft:group id="name">
> <fi:group>
> <fi:styling layout="columns"/>
> <fi:items>
> <ft:widget id="firstname"/>
> <ft:widget id="lastname"/>
> </fi:items>
> </fi:group>
> </ft:group>
> <input type="submit"/>
> </ft:form-template>
>
>
> >
> >
> > but when I execute this code it tells me back that "Form has no child
> > named 'firstname'". This will be fixed removing the <ft:group> tag to
> > the definition file, but this isn't what I want...
> > So, does anyone could tell me how to resolve this problem?
> >
> > Thanks a lot,
> > Omar
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
--
Dr. Omar Adobati
omar.adobati@gmail.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: CForm Definition and CForm Template issue
Posted by Jason Johnston <co...@lojjic.net>.
Omar Adobati wrote:
> Good Morning, here is a snippet of code I'm trying to use:
>
> == form definition ==
>
> <fd:group id="name">
> <fd:field id="firstname" required="true">
> <fd:label>Nome</fd:label>
> <fd:help>First name of the sender of the message</fd:help>
> <fd:datatype base="string"/>
> <fd:validation>
> <fd:length min="2"/>
> </fd:validation>
> </fd:field>
>
> <fd:field id="lastname" required="true">
> <fd:label>Cognome</fd:label>
> <fd:help>Last name of the sender of the message</fd:help>
> <fd:datatype base="string"/>
> <fd:validation>
> <fd:length min="2"/>
> </fd:validation>
> </fd:field>
> </fd:group>
>
> == form template ==
>
> <ft:form-template action="#{$continuation/id}.continue" method="POST">
> <fi:group>
> <fi:styling layout="columns"/>
> <fi:items>
> <ft:widget id="firstname"/>
> <ft:widget id="lastname"/>
> </fi:items>
> </fi:group>
> <input type="submit"/>
> </ft:form-template>
The nested structure of the "ft:" elements has to match that of the
"fd:" elements. So you need the two ft:widget elements to be wrapped
by an <ft:group id="name">...</ft:group>.
Note that the ft:group element is currently just a marker for conveying
the form structure, and doesn't produce any output of its own. So
you'll still need the fi:group to be there, though it may look redundant
at first glance.
<ft:form-template action="#{$continuation/id}.continue" method="POST">
<ft:group id="name">
<fi:group>
<fi:styling layout="columns"/>
<fi:items>
<ft:widget id="firstname"/>
<ft:widget id="lastname"/>
</fi:items>
</fi:group>
</ft:group>
<input type="submit"/>
</ft:form-template>
>
>
> but when I execute this code it tells me back that "Form has no child
> named 'firstname'". This will be fixed removing the <ft:group> tag to
> the definition file, but this isn't what I want...
> So, does anyone could tell me how to resolve this problem?
>
> Thanks a lot,
> Omar
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: CForm Definition and CForm Template issue
Posted by Omar Adobati <om...@gmail.com>.
thanks for your answer, I have still tryied but it does'nt work...
On 8/29/06, Florian Leinberger <le...@seitenbau.com> wrote:
> Hi,
>
> try the following in the template:
>
> <ft:widget id="name/firstname"/>
>
> Gruss, Florian
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
--
Dr. Omar Adobati
omar.adobati@gmail.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: CForm Definition and CForm Template issue
Posted by Florian Leinberger <le...@seitenbau.com>.
Hi,
try the following in the template:
<ft:widget id="name/firstname"/>
Gruss, Florian
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org