Ok...  that is one is clear now.

 

Apparently the servlet is not running at the time the spring root
webapplicationcontext is being initialized so that makes sense that I
get a connection refused exception ;-)

 

Robby

 

From: Robby Pelssers [mailto:[email protected]] 
Sent: Wednesday, September 16, 2009 5:51 PM
To: [email protected]
Subject: how-to create a form widget instance from within java

 

Hi all,

 

Like I've mentioned before on this list, I'd like to do as much as
possible from within java instead of flowscript... 

 

So I started looking at how form.js takes care of creating a
formdefinition/form.  

 

I configured my packageSearcher as follows:

 

 

  <bean id="packageSearcher"
class="com.nxp.spider2.parametricsearch.cforms.ObjectSearcherImpl">

    <constructor-arg ref="packageSelector"/>

    <constructor-arg ref="org.apache.cocoon.forms.FormManager"/>    

  </bean>

 

 

The constructor of this class looks like the snippet below:

 

0     public ObjectSearcherImpl(SearchableObjectSelector
searchableObjectSelector, FormManager formManager) {

1           this.searchableObjectSelector = searchableObjectSelector;

2

3           try {

4                 this.form =
formManager.createForm("cocoon://formdefinition");

5           } catch (Exception e) {

6                 e.printStackTrace();

7           }

8           

9           //this.form = form;

10          this.selectedProperties = new ArrayList<String>();

11          initialize();

12    }

 

 

I run each time in an exception on line 4:

org.apache.cocoon.forms.FormsException: Could not resolve form
definition URI. at [FormManager] - cocoon://formdefinition

 

While in flowscript I use the same sourceURI and it does work properly:

 
cocoon.load("servlet:forms:/resource/internal/flow/javascript/Form.js");

  this.form = new Form("cocoon://formdefinition");

 

Can anybody point me out to why this does not work? And perhaps give me
any clues on how to create a Form instance in java?

 

Ps... I also tried with a hardcoded URI
http://localhost:8888/parametricsearch/formdefinition but that did not
work as well.

 

Thx in advance,

Robby Pelssers

Reply via email to