Te dejo mis constructores
Noticia
Código:
public class Noticia{
private Integer idNoticia;
private String tituloNoticia;
private String contenidoNoticia;
private String fechaModifNoti;
private int idUsuario;
private Imagen imagen;
public Noticia() {
}
public Noticia(Integer idNoticia) {
this.idNoticia = idNoticia;
}
public Noticia(Integer idNoticia, String tituloNoticia, String contenidoNoticia, String fechaModifNoti, int idUsuario, Imagen imagen) {
this.idNoticia = idNoticia;
this.tituloNoticia = tituloNoticia;
this.contenidoNoticia = contenidoNoticia;
this.fechaModifNoti = fechaModifNoti;
this.idUsuario = idUsuario;
this.imagen = imagen;
}
public Integer getIdNoticia() {
return idNoticia;
}
public void setIdNoticia(Integer idNoticia) {
this.idNoticia = idNoticia;
}
public String getTituloNoticia() {
return tituloNoticia;
}
public void setTituloNoticia(String tituloNoticia) {
this.tituloNoticia = tituloNoticia;
}
public String getContenidoNoticia() {
return contenidoNoticia;
}
public void setContenidoNoticia(String contenidoNoticia) {
this.contenidoNoticia = contenidoNoticia;
}
public String getFechaModifNoti() {
return fechaModifNoti;
}
public void setFechaModifNoti(String fechaModifNoti) {
this.fechaModifNoti = fechaModifNoti;
}
public int getIdUsuario() {
return idUsuario;
}
public void setIdUsuario(int idUsuario) {
this.idUsuario = idUsuario;
}
public Imagen getImagen() {
return imagen;
}
public void setImagen(Imagen imagen) {
this.imagen = imagen;
}
}
Imagen
Código:
public class Imagen {
private Integer idImagen;
private String urlImagen;
private int idNoticia;
public Imagen() {
}
public Imagen(Integer idImagen) {
this.idImagen = idImagen;
}
public Imagen(Integer idImagen, String urlImagen, int idNoticia) {
this.idImagen = idImagen;
this.urlImagen = urlImagen;
this.idNoticia = idNoticia;
}
public Integer getIdImagen() {
return idImagen;
}
public void setIdImagen(Integer idImagen) {
this.idImagen = idImagen;
}
public String getUrlImagen() {
return urlImagen;
}
public void setUrlImagen(String urlImagen) {
this.urlImagen = urlImagen;
}
public int getIdNoticia() {
return idNoticia;
}
public void setIdNoticia(int idNoticia) {
this.idNoticia = idNoticia;
}
}
Error
Código:
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: java.lang.NullPointerException
root cause
java.lang.NullPointerException
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 3.0.1 logs.
Debo decir que este error me sale casi siempre cuando declaro algo mal o no es valido, pero por mas que le busco no se donde esta el error, mas encima como dije no me acusa ningun error antes de ejecutarlo.
Hice la prueba de crear todos los atributos de imagen a noticia y me resulta pero aun no me resulta de meter un constructor dentro de otro...:S
Gracias!