I'm sure i've misunderstood beans, but if I write a standalone java application that does the same thing, i dont get the error...
the pointer that is null is the pointer to the List called moYe, which is filled in the beans constructor. Also, if I try to access the LabNews object, that also produces a null pointer exception, so is it me, or should i NOT be initialising and filling these objects in the constructor?

or is it not persisting?

thanks
S


package xml.labnews;

import java.io.*;
import java.util.*;

import javax.servlet.http.*;
import javax.servlet.*;

import javax.xml.bind.*;

import sam.xml.*;

public class calendarBean extends HttpServlet {

private String name;
private String type;
private String output;
private long size;
private Labnews ln;
private List moYe;
final private String fileName = "labnews.xml";

public calendarBean(){
try {
JAXBContext jc = JAXBContext.newInstance("sam.xml");
Unmarshaller u = jc.createUnmarshaller();
ln = (Labnews)u.unmarshal(new FileInputStream("labnews.xml"));
moYe = ln.getMoye();
}catch( JAXBException je ) {
je.printStackTrace();
} catch( IOException ioe ) {
ioe.printStackTrace();
}

name="";
type="";
output="";
}

public void setLabNews(Labnews x){
ln=x;
}

public Labnews getLabNews(){
return ln;
}

public void setName(String x){
name=x;
}

public void setType(String x){
type=x;
}

public void setOutput(String x){
output=x;
}

public void appendOutput(String x){
output=output+x;
}

public void setSize(long x){
size=x;
}

public String getFileName(){
return fileName;
}

public String getName(){
return name;
}

public String getType(){
return type;
}

public String getOutput(){
return output;
}

public long getSize(){
return size;
}

public Integer[] getLinkedDays(int year, int month){
List days = new ArrayList();

days.add(new Integer(moYe.size()));

return (Integer[])days.toArray(new Integer[days.size()]);
}

}

"JC Rules"



_________________________________________________________________
Broadband?�Dial-up? Get reliable MSN Internet Access. http://resourcecenter.msn.com/access/plans/default.asp


--
To unsubscribe, e-mail: <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>

Reply via email to