You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jeroen Cranendonk <j....@emaxx.nl> on 2003/02/27 14:27:43 UTC

xmlforms + multiple beans ?

My college has asked me to post the folliwing question.

He's working with cocoon xmlforms, implementing a system where
a user can fill out forms. There are a large number of seperate sequences of 
forms that can be followed. (file a complaint, file something else, etc.) 
Each of these sequences is currently associated with one javabean which holds 
the data for that sequence.

The problem lies in that many sequences share common parts, say the adress
data of the user for example.
What he would like is to be able to reuse both the forms and a bean for this 
kind of data, say a CommonUserAdressBean and a commongetuserdataform.xml

I believe the form can be fairly easily reused, but when trying to have a 
reusable bean we run into the problem that a form can only have a single
bean/model associated with it. Or atleast so I believe.

Does anyone have any ideas of how to get round this, or how we could apporach 
this differently ? (besides using the adress(for example) bean as a subclass 
for the other bean, this would break if we want to use more then one generic 
bean)

So in short , we want to associate more then one bean with an xmlform as its 
model, to be able to use one or several beans that are shared between many 
sequences of forms, and one that's specific to a certain sequence of forms.

Many thanks in advance :)

	Jeroen Cranendonk.


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: xmlforms + multiple beans ?

Posted by Jeroen Cranendonk <j....@emaxx.nl>.
Yay, thanks! 
We did not know that xmlforms would understand this syntax. that's why we 
didn't use composition :)

hmm, schematrons don't accidently support composition too do they ? :)

> <snip/>
>
> > Does anyone have any ideas of how to get round this, or how we could
> > apporach this differently ? (besides using the adress(for example) bean
> > as a subclass for the other bean, this would break if we want to use more
> > then one generic bean)
>
> Why don't you use composition instead of inheritance?
>
> public class MyBean {
>    private Address address;
>    public Address getAddress() { return address; }
>    public void setAddress(Address address) { this.address = address; }
>    ...
> }
>
> <xf:textbox ref="/address/street" ...>
> <xf:textbox ref="/address/zipcode" ...>
>
> 	Ugo


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Re: xmlforms + multiple beans ?

Posted by Ugo Cei <u....@cbim.it>.
Jeroen Cranendonk wrote:
<snip/>
> Does anyone have any ideas of how to get round this, or how we could apporach 
> this differently ? (besides using the adress(for example) bean as a subclass 
> for the other bean, this would break if we want to use more then one generic 
> bean)

Why don't you use composition instead of inheritance?

public class MyBean {
   private Address address;
   public Address getAddress() { return address; }
   public void setAddress(Address address) { this.address = address; }
   ...
}

<xf:textbox ref="/address/street" ...>
<xf:textbox ref="/address/zipcode" ...>

	Ugo


-- 
Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
Phone: +39.0382.525100 - E-mail: u.cei@cbim.it


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


DVSL Velocity xml transformation

Posted by Dario Liberman <co...@ineba.net>.
Hello,

I was wondering if there exist a simple way to incorporate DVSL as a
transformer.
Since there is already a plugin for xml generation with velocity, perhaps it
is simple to incorporate a transformation with velocity.

It is very powerfull, since allows during the transformation to call java
objects, allowing even document oriented programming if it is desired (ie.
the xml in prior layers may have commands to be processed, like an xml from
a soap request or alike).

See DVSL:

http://jakarta.apache.org/velocity/dvsl/index.html

For thoose interested, here is an example of a dvsl file:

http://cvs.apache.org/viewcvs/jakarta-velocity-dvsl/src/stylesheets/site.dvs
l?rev=1.4&content-type=text/vnd.viewcvs-markup

Thanks,
Dario.


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Ad: xmlforms + multiple beans ?

Posted by Jeroen Cranendonk <j....@emaxx.nl>.
Among the same line of thought, is it possible to include schematron (the ones 
used to validate say the users address fields) in other schematron files ? 
(by link/reference, not copy paste :) same reason again, it'd be nice to once 
write a piece of schematron code, and then use it in any forms you do that 
have adress info too.

many thanks in advance,
	Jeroen Cranendonk


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org