Estou tendo problemas com esse erro aí, já tentei de tudo e nada, sempre retorna esse erro, “Error testing property ‘titulo’ in bean of type null”.
:arrow: # Bean #
package veja;
import java.sql.*;
public class Noticias {
private String id;
private String titulo = "";
private String noticia = "";
private String resumo = "";
private String autor = "";
private String data = "";
private String foto = "";
private String credito = "";
private int posicao = 0;
private int categoria = 0;
private int prioridade = 0;
private int ativo = 0;
private String status = "";
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitulo() {
return titulo;
}
public void setTitulo(String titulo) {
this.titulo = titulo;
}
public String getNoticia() {
return noticia;
}
public void setNoticia(String noticia) {
this.noticia = noticia;
}
public String getResumo() {
return resumo;
}
public void setResumo(String resumo) {
this.resumo = resumo;
}
public String getAutor() {
return autor;
}
public void setAutor(String autor) {
this.autor = autor;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public String getFoto() {
return foto;
}
public void setFoto(String foto) {
this.foto = foto;
}
public String getCredito() {
return credito;
}
public void setCredito(String credito) {
this.credito = credito;
}
public int getPosicao() {
return posicao;
}
public void setPosicao(int posicao) {
this.posicao = posicao;
}
public int getCategoria() {
return categoria;
}
public void setCategoria(int categoria) {
this.categoria = categoria;
}
public int getPrioridade() {
return prioridade;
}
public void setPrioridade(int prioridade) {
this.prioridade = prioridade;
}
public int getAtivo() {
return ativo;
}
public void setAtivo(int ativo) {
this.ativo = ativo;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String incluirNoticia(){
Connection cn = Conexao.obterConexao();
PreparedStatement pst = null;
try {
String q = "";
q = " insert into noticias (titulo, noticia, resumo, autor, data, foto, credito, posicao, categoria, prioridade, ativo) values (?,?,?,?,?,?,?,?,?,?,?)";
pst = cn.prepareStatement(q);
pst.setString(1, titulo);
pst.setString(2, noticia);
pst.setString(3, resumo);
pst.setString(4, autor);
pst.setString(5, data);
pst.setString(6, foto);
pst.setString(7, credito);
pst.setInt(8, posicao);
pst.setInt(9, categoria);
pst.setInt(10, prioridade);
pst.setInt(11, ativo);
pst.executeUpdate();
status = "Notícia incluída no Banco de Dados!";
return "sucesso";
} catch (SQLException e) {
status = "Notícia não inclusa, procure Márcio";
return "falha";
}
}
}
:arrow: # faces-config #
<?xml version="1.0" encoding="UTF-8"?><application>
<locale-config>
<default-locale>pt</default-locale>
<supported-locale>en</supported-locale>
</locale-config>
<message-bundle>
Erros
</message-bundle>
</application>
<navigation-rule>
<from-view-id>/cadnoticia.jsp</from-view-id>
<navigation-case>
<from-outcome>sucesso</from-outcome>
<to-view-id>/not_incluida.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>falha</from-outcome>
<to-view-id>/error.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<managed-bean>
<description>Cad_Noticias</description>
<managed-bean-name></managed-bean-name>
<managed-bean-class>veja.Noticias</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
:arrow: # JSP #
<%@ taglib uri=“http://java.sun.com/jsf/core” prefix=“f” %>
<%@ taglib uri=“http://java.sun.com/jsf/html” prefix=“h” %>
Incluir Notícias
| Título: | ||
| Notícia: | ||
| Resumo: | ||
| Autor: | ||
| Data: | ||
| Foto: | ||
| Crédito da Foto: | ||
| Posição: | ||
| Categoria: | ||
| Prioridade: | ||
| Ativa: |