I implemented a small example bean using lists, and the XML generated looks as expected. Here is the partial source code of the bean. Note the default constructor that artificially initializes the addressList.
public class HelloForm {
private List addressList; public class Address {
private String name;
private List phoneList; public Address(String name, String p1, String p2) {
this.name = name;
this.phoneList = new ArrayList();
this.phoneList.add(p1);
this.phoneList.add(p2);
} public String getName() {
return name;
} public void setName(String name) {
this.name = name;
} public List getPhoneList() {
return phoneList;
} public void setPhoneList(List phoneList) {
this.phoneList = phoneList;
}
} public HelloForm() {
List a = new ArrayList();
setAddressList(a); Address a1 = new Address("julien", "987", "654");
Address a2 = new Address("alex", "123", "456"); a.add(a1);
a.add(a2);
} public List getAddressList() {
return addressList;
} public void setAddressList(List addressList) {
this.addressList = addressList;
}}
And the the XML document generated by the BeanGenerator:
<beans>
<hello>
<address-list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="java:org.orbeon.oxf.struts.examples.hello.HelloForm$Address">
<name>julien</name>
<phone-list xsi:type="java:java.lang.String">987</phone-list>
<phone-list xsi:type="java:java.lang.String">654</phone-list>
</address-list>
<address-list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="java:org.orbeon.oxf.struts.examples.hello.HelloForm$Address">
<name>alex</name>
<phone-list xsi:type="java:java.lang.String">123</phone-list>
<phone-list xsi:type="java:java.lang.String">456</phone-list>
</address-list>
</hello>
</beans>
Concerning the message bundle issue, I updated the OXF code to use the new Struts 1.1 <message-resource> tag. I will send you the patch in a separate email.
Regards, Julien
Kesara Kudalugodaarachchi wrote:
Hi Julien,
The requirement with the List is that we need to send a List of object which
are of user defined type, contained in Struts from beans. For eg. we can
have method in the form bean "getAdrressList" which would return a
"java.util.List" and an "Address" is a user defined object which has "name",
"street", "country" etc. Please note that the "Address" class may contain
"List" of phones with the "getPhonesList".
I checked in Castor site and it seems that they support marshalling of
collections above the version 0.9.4. Therefore probably it should be
possible to implement this functionality within OXF.
Regards,
Kesara.
-----Original Message-----
From: Kesara Kudalugodaarachchi
Sent: Tuesday, July 29, 2003 12:12 PM
To: OXF Users
Subject: Missing functionality
Hi,
We have two basic requirements and based on the testing we did on OXF, they
don't seem to be supported. Note: All of this is related to struts
integrated mode.
1. OXF can not parse the user defined Lists contained in the beans that we
put in the request. i.e. We have a RoleTOList that contain RoleTOs. The
generated out put looks like
<beans>
<role>
<roleTOList>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="java:java.util.ArrayList"></list>
</roleTOList>
</role>
</beans>
2. OXF still uses the Struts 1.0 message bundle loading mechanism not Struts
1.1 where you can have multiple message bundles.
More over struts 1.1 puts the bundles in request scope instead of
application scope.
i.e. struts-config.xml entries would look like
<message-resources
parameter="arasys.i18n.default.ApplicationResources"
factory="com.arasys.client.framework.struts.ArasysPropertyMessageResourcesFa
ctory"
key="ErrorMessages"/>
OXF fails when the key is not the default as in
org.apache.struts.Globals.MESSAGES_KEY
Is it possible have a patch for these two issues?
Regards,
Kesara.
_______________________________________________
oxf-users mailing list
[EMAIL PROTECTED]
http://mail.orbeon.com/mailman/listinfo/oxf-users
_______________________________________________
oxf-users mailing list
[EMAIL PROTECTED]
http://mail.orbeon.com/mailman/listinfo/oxf-users
_______________________________________________ oxf-users mailing list [EMAIL PROTECTED] http://mail.orbeon.com/mailman/listinfo/oxf-users
