Thanks Vadim.
    
To Christian Haul,
    Your suggestion was good and I wanted to do that
but my understanding of both the form and dbAddAction
have been somewhat poor... So I am "putting" all
actions I wanna do together so that I can get used to
the Cocoon API. 

Here is what I am doing, but it throws
ComponentException saying "could not find Component
Exception!". It is this line: 
ComponentSelector selector = (ComponentSelector)
manager.lookup(datasource.ROLE);
that throws the exception. I have defined my
datasource and sql driver in the sitemap and they are
working fine. Where did I go wrong?



import org.apache.avalon.excalibur.datasource.*;
import
org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.acting.AbstractAction;
import org.apache.cocoon.Constants;
import java.util.Map;
import java.util.HashMap;
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.environment.Redirector;
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.environment.SourceResolver;
import
org.apache.cocoon.environment.ObjectModelHelper;
import org.xml.sax.EntityResolver;
import org.apache.avalon.framework.component.*;
import org.apache.cocoon.acting.ComposerAction;

//import java.sql stuff

public class SendAction extends ComposerAction
implements ThreadSafe
{
  
    DataSourceComponent datasource = null;
    //other form variables...
  
  public Map act (Redirector redirector,
                  SourceResolver resolver,
                  Map objectModel,
                  String source,
                  Parameters params) {
    
    //declares new Map for return object
    Map sitemapParams = new HashMap();    
    Request request =
ObjectModelHelper.getRequest(objectModel);
    
    //validate form input        
        
    //if valid, insert them to the database
        this.getDB(manager);
            
    //....

    return sitemapParams;
  }//end Act
==============================================================

public void getDB() throws ComponentException
  {
        super.compose(manager);
        ComponentSelector selector = (ComponentSelector)
manager.lookup(datasource.ROLE);
        this.datasource = (DataSourceComponent)
selector.select("Card");

        //now do DB insert...
}//end getDB

__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to