Mike Casey | 1 Jun 2006 02:06
Picon

Cocoon and Spring

Can anyone tell me the experiences they have had with running cocoon with spring? In particular, how did you get Spring to run Cocoon and how was this deployed under tomcat? Does the spring MVC framework get in the way of things? Or could they possibly complement each other?

Cheers

MC

Jason Johnston | 1 Jun 2006 05:23

Re: Cocoon and Spring

Mike Casey wrote:
> Can anyone tell me the experiences they have had with running cocoon 
> with spring? In particular, how did you get Spring to run Cocoon and how 
> was this deployed under tomcat? Does the spring MVC framework get in the 
> way of things? Or could they possibly complement each other?

The simplest integration is probably to initialize the Spring 
application context in web.xml with a ContextLoaderListener:

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

Then you can get access to the application context from anywhere you 
have a cocoon Context object, e.g. from flowscript:

var appCtxt = cocoon.context.getAttribute(
Packages.org.springframework.web.context.WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
);
var myService = appCtxt.getBean("myServiceBean");

There are also other techniques for getting access to Spring managed 
services; do a search for "spring" at http://wiki.apache.org/cocoon for 
some examples.

The next major version of Cocoon (2.2 or 3.0, not sure what it will end 
up being labeled) has actually been changed so that it uses Spring 
internally for its component management, so the integration should be 
that much cleaner.

In terms of Spring MVC, I don't know how it and Cocoon would play 
alongside each other, since Cocoon is itself an MVC framework. 
Personally I've never seen a need to use Spring MVC when I've got such a 
good one in Cocoon. :)  I'd be interested to hear if anyone else has had 
experience combining them though.
Simone Gianni | 1 Jun 2006 05:31
Picon

Re: Cocoon form/ajax problem

Hi Duncan,
I think you should use the <fd:widgets> element :

<fd:group>
  <fd:widgets>
    <fd:submit .....

If not, the definition builder simply ignores your submit button.

Hope this helps!

Simone

Duncan McLean wrote:

>Hi
>
>Is it possible to put a submit widget within a group and then ajax enable
>a form? i've tried putting a widget into a group and i am getting a
>"cannot convert null to an object" when i try to load the form.
>
>form definition:
>
><fd:group id="submitBottomFunds">
>	<fd:submit id="funds" state="invisible" validate="true">
>		<fd:label>Funds ARF</fd:label>
>	</fd:submit>
></fd:group>
>
>form template:
>
><ft:group id="submitBottomFunds">
>	<ft:widget id="funds">
>		<fi:styling type="link"/>
>	</ft:widget>
></ft:group>
>
>flowscript
>
>fundsLinkBottom =
>forms["funds_amrf"].getChild("submitBottomFunds").getChild("funds");
>fundsLinkBottom.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.INVISIBLE);
>
>it is this last line which is causing the error. any help would be much
>appreciated.
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe <at> cocoon.apache.org
>For additional commands, e-mail: users-help <at> cocoon.apache.org
>
>  
>
--

-- 
Simone Gianni
Simone Gianni | 1 Jun 2006 06:02
Picon

Re: CForms tree-model using xml as source?

Hi Fred,
this seems to be nice stuff, if you can, why don't you contribute it?
You can do that opening a JIRA issue with "[PATCH]" in the title, a
description of what your code does and how it works, and then attaching
your source code to it.

Simone

Fred Vos wrote:

>On Tue, May 30, 2006 at 04:11:57PM +0200, Martijn C. Vos wrote:
>  
>
>>Is there an easy way to get the data for my tree widget from XML instead of a file
>>structure? I'm reading http://cocoon.apache.org/2.1/userdocs/widgets/widget_tree.html
>>and looking at the samples, and while I think basing a tree on an xml structure is
>>a very cocoon thing to do, I'm getting the impression I'd have to write that
>>tree-model myself.
>>
>>What I'd like to be able to do is something like:
>>
>>    <fd:tree id="foo" selection="multiple|single">
>>      <fd:tree-model type="xml" src="cocoon://tree.xml">
>>        <fd:nodes xpath="//node" label=" <at> name"/>
>>      </fd:tree-model>
>>    </fd:tree>
>>
>>Or something along those lines. Doesn't sound too unreasonable, but it looks
>>like it doesn't exist yet. Or am I wrong?
>>    
>>
>
>Hello Martijn,
>
>We needed such an extension too at work. Based on
>org.apache.cocoon.forms.formmodel.tree.DefaultTreeModel, I was able to create
>a widget that reads its contents from an XML document. The current
>implementation is a little ugly but it works. The widget parses the XML
>document (using XOM) and then this document is transformed into the tree
>structure used in DefaultTreeModel.
>
>I'll send you the sources.
>
>One improvement we need is the possibility to access extra data in the XML
>document.
>
>Fred
>
>  
>
--

-- 
Simone Gianni
cocoon.erard | 1 Jun 2006 10:35
Picon

custom validator is not called

Hello, 

I'm using the following construct to display or hide a field. This is only an Example, I'currently testing something.
My problem is now, that my Java validator is never called. Is this a Bug or did I make a misstake? When i use the
validator elsewhere, there's no problem.

Thanks Mike

<fd:union id="chipunion" case="../page1/type">
<fd:widgets>
	<fd:group id="case1">
		<fd:widgets>
		</fd:widgets>
	</fd:group>
	<fd:group id="case2">
		<fd:widgets>
			<fd:field id="chip" required="true">
				<fd:label>chip application:</fd:label>
				<fd:datatype base="string"/>
				<fd:selection-list>
					<fd:item value="cash"/>
					<fd:item value="cash + emv"/>
				</fd:selection-list>
				<fd:validation>
					<fd:java class="ch.corix.cocoon.validator.EmvValidator" />
				</fd:validation>
			</fd:field>
		</fd:widgets>
	</fd:group>
</fd:widgets>
</fd:union> 

____________________________________________
QuickLine WebMail - http://www.QuickLine.com
Mike Casey | 1 Jun 2006 11:10
Picon

Re: Cocoon and Spring

Great thanks heaps for that Jason. Thats pretty much what I thought was the case with the MVCs. I am an XML processing fanatic, so I am heading Cocoon all the way:-) It is interesting to see that Cocoon and Spring are getting closer links. Lets hope it doesnt turn out like the whole hibernate fiasco!

MC

On 6/1/06, Jason Johnston <cocoon <at> lojjic.net> wrote:
Mike Casey wrote:
> Can anyone tell me the experiences they have had with running cocoon
> with spring? In particular, how did you get Spring to run Cocoon and how
> was this deployed under tomcat? Does the spring MVC framework get in the
> way of things? Or could they possibly complement each other?

The simplest integration is probably to initialize the Spring
application context in web.xml with a ContextLoaderListener:

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

Then you can get access to the application context from anywhere you
have a cocoon Context object, e.g. from flowscript:

var appCtxt = cocoon.context.getAttribute(
Packages.org.springframework.web.context.WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
);
var myService = appCtxt.getBean("myServiceBean");

There are also other techniques for getting access to Spring managed
services; do a search for "spring" at http://wiki.apache.org/cocoon for
some examples.

The next major version of Cocoon (2.2 or 3.0, not sure what it will end
up being labeled) has actually been changed so that it uses Spring
internally for its component management, so the integration should be
that much cleaner.

In terms of Spring MVC, I don't know how it and Cocoon would play
alongside each other, since Cocoon is itself an MVC framework.
Personally I've never seen a need to use Spring MVC when I've got such a
good one in Cocoon. :)  I'd be interested to hear if anyone else has had
experience combining them though.

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


Derek Hohls | 1 Jun 2006 11:23
Picon

Re: Cocoon and Spring

What Hibernate fiasco?? I thought Cocoon & Hibernate worked pretty 
well together?

>>> werdafucami <at> gmail.com 2006/06/01 11:10 AM >>>

Great thanks heaps for that Jason. Thats pretty much what I thought was the case with the MVCs. I am an XML
processing fanatic, so I am heading Cocoon all the way:-) It is interesting to see that Cocoon and Spring
are getting closer links. Lets hope it doesnt turn out like the whole hibernate fiasco! 

MC

On 6/1/06, Jason Johnston <cocoon <at> lojjic.net> wrote:Mike Casey wrote:
> Can anyone tell me the experiences they have had with running cocoon
> with spring? In particular, how did you get Spring to run Cocoon and how
> was this deployed under tomcat? Does the spring MVC framework get in the 
> way of things? Or could they possibly complement each other?

The simplest integration is probably to initialize the Spring
application context in web.xml with a ContextLoaderListener:

<listener> 
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

Then you can get access to the application context from anywhere you
have a cocoon Context object, e.g. from flowscript:

var appCtxt = cocoon.context.getAttribute(
Packages.org.springframework.web.context.WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
);
var myService = appCtxt.getBean("myServiceBean"); 

There are also other techniques for getting access to Spring managed
services; do a search for "spring" at http://wiki.apache.org/cocoon for
some examples. 

The next major version of Cocoon (2.2 or 3.0, not sure what it will end
up being labeled) has actually been changed so that it uses Spring
internally for its component management, so the integration should be 
that much cleaner.

In terms of Spring MVC, I don't know how it and Cocoon would play
alongside each other, since Cocoon is itself an MVC framework.
Personally I've never seen a need to use Spring MVC when I've got such a 
good one in Cocoon. :)  I'd be interested to hear if anyone else has had
experience combining them though.

--

-- 
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.

CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html 

CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html 

For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
HelpDesk <at> csir.co.za.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.
Lionel Crine | 1 Jun 2006 11:40
Picon
Favicon

Cforms repeater

Hi,

I encounter a problem with a cform.

I have a repeater that creating trouble with the rest of the form :
When I  "add a row" or "delete a row", I lost the focus on my "htmlarea" 
widget and "multivaluefield" widget. Why That ?

I also saw that we need to do a workaround in the submit widget to 
handle correctly the htmlarea values. Is it the case in cocoon 2.1.7 ?

Thanks

Lionel
Kris Schneider | 1 Jun 2006 13:45
Picon
Gravatar

Re: CFORMS: Accept Multiple Date Formats

On 5/31/06, Patrick Refondini <patrick.refondini <at> pobox.com> wrote:
> Daniel Curran wrote:
> > I have a date field in my form definition setup as:
> >
> > <fd:field id="dscdate">
> >  <fd:datatype base="date">
> >    <fd:convertor type="formatting">
> >      <fd:patterns>
> >        <fd:pattern>MM-dd-yyyy</fd:pattern>
> >        <fd:pattern>MM/dd/yyyy</fd:pattern>
> >      </fd:patterns>
> >    </fd:datatype>
> > </fd:field>
> >
> > When a user enters a date such as 10-20-2005 a failure is the result,
> > with the form generating a validation message. When entering the date as
> > 10/20/2005 the submission is successful. Is it possible to accept both
> > these formats? If so how should this be setup?
> >
> > Thanks,
> > Dan
>
> Hi Daniel,
> The only way I know to have "multiple" patterns is with locale:
>
> <fd:convertor type="formatting">
>    <fd:patterns>
>      <fd:pattern>MM/dd/yyyy</fd:pattern>
>      <fd:pattern locale="nl-BE">dd/MM/yyyy</fd:pattern>
>      <fd:pattern locale="fr">dd-MM-yyyy</fd:pattern>
>    </fd:patterns>
> </fd:convertor>
>
> Example taken from:
> http://cocoon.apache.org/2.1/userdocs/widgetconcepts/datatypes.html
>
> But this won't allow two "active" patterns at the same time which seems
> to be what you're after.

Right, it looks like a custom
FormattingDateConvertorBuilder/FormattingDateConvertor would be
needed. The standard builder just calls:

convertor.setNonLocalizedPattern(pattern)

If there's no locale provided for a pattern. So, you'd need a
builder/convertor that would do something like this instead:

convertor.addNonLocalizedPattern(pattern) // new convertor method

The convertor would then have to cycle through the non-localized
patterns and use the first one that formats/parses without an error.

> You might also consider using aggregated fields, see (click "switch"
> button):
> http://cocoon.zones.apache.org/demos/release/samples/blocks/forms/aggregate/example
>
> Just hints,
>
> Patrick

--

-- 
Kris Schneider <mailto:kschneider <at> gmail.com>
Dan Hertz | 1 Jun 2006 17:23

Flowscript file permissions on mkdir - pls help!

Hi,

The following flowscript dynamically makes a directory and uploads a 
photo to it:

===Extracts===

  var uploadWidget = form.lookupWidget("upload");
  if (uploadWidget.getValue() != null) {

      // test if user directory exists, if not, create it
       if (!userDir.exists()) {        
           userDir.mkdirs();
       }
    uploadWidget.getValue().copyToFile(userDir + "/" + fileName);
  }

===========

On Windows this works great; but on LINUX, the folder gets created with 
0755 permissions (set by my ISP). This is insufficient to run my PHP 
script on the photo -- which needs the folder to be set to 0774.

How do I set the folder permission values from this flowscript?

Thanks for helping this total newbee!

Daniel

Gmane