cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Merico Raffaele <raffaele.mer...@less.ch>
Subject AW: Cform binding
Date Mon, 04 Dec 2006 15:16:22 GMT
Hi Mark

 

Many thanks for your support.

I want to come back and explain to you my need.

I have a cocoon form that will be bind to XML values coming from a web
service.

To bind the right data in the XML stream I need an ID passed by the request.
So I can do something like the following ...

 

<fb:context path="/data//personenkreis[@id =
/data/h:request/h:requestParameters/h:parameter[@name='pkId']/h:value]">

      <fb:value id="planTyp" path="primat"/>

</fb:context>

 

NB: <personenkreis/> exists here more than one time.

Since actually $cocoon is not available I solved the problem by aggregating
the cocoon request to the XML response of my web service.

 

Hope this explains my need ... Raffaele

 

  _____  

Von: Mark Lundquist [mailto:ml@wrinkledog.com] 
Gesendet: Freitag, 1. Dezember 2006 19:18
An: users@cocoon.apache.org
Betreff: Re: Cform binding

 

 

On Dec 1, 2006, at 9:30 AM, Gabriele Columbro wrote: 

 

Not sure about JXPath but I suppose it should be possible in the exact same
way it is possible in the JXTemplate (not sure though, so better try it)
more or less like: 

 

${cocoon.request.getParameter('foo') } 

 

If this were supported (see below), it would not be like JXT syntax! :-) 

 

JXPath [1] is an interpretation of Xpath [2] for Java object graphs. With
some funny quirks [3]. 

 

So in a CForms binding, I guess (IIRC what you're trying to do) the JXPath
would have to be something like this: 

 

        /foo/bar[@name = $cocoon/request/parameter/beer] 

 

However, I don't see anything in the source code that suggests we are
injecting the cocoon FOM object into the JXPath context. That could easily
be done, I guess. 

 

Using FOM objects to dynamically drive the forms binding does seem exotic,
though. Care to share some more details about your use case for this? I'd be
interested to hear... 

 

Anyway, think you'll have to do this part of the load/save by hand, in
flowscript. Assuming your binding has other things to do besides the part
that depends on FOM objects, I would suggest using your load/save normally
using the binding framework for the "normal" parts, then doing the dynamic
"binding" parts by hand in flowscript. You could even still use JXPath for
this (by hand), building your path expression using string concatenation. 

 

HTH, 

-ml- 

 

[1] http://jakarta.apache.org/commons/jxpath 

[2] http://www.w3.org/TR/xpath 

[3] http://jakarta.apache.org/commons/jxpath/users-guide.html#Attributes


Mime
View raw message