Hi,
I'd like to save an ArrayList to xml file with XMLEncoder, it seems that its
writeobject method will cause exceptions in T5 app, but works fine in a
regular java app. here is my code:
public class TestMenuP {
class Person {
private String name;
Person() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
private ArrayList lst = new ArrayList();
public TestMenuP() {
Person p = new Person();
p.name = "test";
lst.add(p);
try {
FileOutputStream fos = new
FileOutputStream("/Users/justinchua/bfe/address22.xml");
XMLEncoder xenc = new XMLEncoder(fos);
xenc.writeObject(lst);
xenc.close();
fos.close();
} catch (FileNotFoundException e) {// TODO Auto-generated catch
block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch blocke.printStackTrace();
}
}
}
creating an object of above class in a page class will cause exceptions:
java.lang.InstantiationException: org.bfe.istudio.t5.TestMenuP$Person
Continuing ...
java.lang.Exception: XMLEncoder: discarding statement
ArrayList.add(TestMenuP$Person);
Continuing ...
I have placed the above class outside of pages/components packages, any
idea? thanks.
A.C.
--
View this message in context:
http://www.nabble.com/T5%3A-Can-XMLEncoder-be-used-with-T5-app--tf4362923.html#a12435520
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]