el - PropertyNotFoundException exception in the JSP page -
this question has answer here:
i'm trying edit entity through jsp page
<jsp:include page="menueditardisciplina.jsp"> <jsp:param name="iddisciplina" value='<%=request.getparameter("id")%>'/> </jsp:include>
the servlet code i'm using
public class inseredisciplina implements logica { private clienterestdisciplina clienterestdisciplina; private clienterestcurso clienterestcurso; public void executa(httpservletrequest req, httpservletresponse res) throws exception { clienterestdisciplina = new clienterestdisciplina(); clienterestcurso = new clienterestcurso(); string idcursos = req.getparameter("idcurso"); integer idcurso = (idcursos != null) ? integer.parseint(idcursos) : null; string idprofessors = req.getparameter("idprofessor"); integer idprofessor = (idprofessors != null) ? integer .parseint(idprofessors) : null; string iddisciplinas = req.getparameter("id"); integer iddisciplina = (iddisciplinas != null) ? integer .parseint(iddisciplinas) : null; disciplina disciplina = iddisciplina == null ? new disciplina() : clienterestdisciplina.getdisciplina(iddisciplina); disciplina.setnome(req.getparameter("nome")); disciplina.setsala(integer.parseint(req.getparameter("sala"))); string datastring = req.getparameter("horario").tostring(); disciplina.sethorario(date.valueof(datastring)); disciplina.setcargahoraria(integer.parseint(req .getparameter("cargahoraria"))); disciplina.setdescricao(req.getparameter("descricao")); if (disciplina.getiddisciplina() != null) { clienterestdisciplina.editardisciplina(disciplina); } else { clienterestcurso.inserirdisciplinanocurso(idcurso, idprofessor, disciplina); } res.sendredirect("disciplina/listardisciplinas.jsp"); } }
my java bean class below
@xmlrootelement public class disciplina implements serializable { private static final long serialversionuid = 1l; private integer id; public disciplina() { } public disciplina(integer id) { this.id = id; } public disciplina(integer id, string nome, string descricao, int cargahoraria, date horario, int sala) { this.id = id; this.nome = nome; this.descricao = descricao; this.cargahoraria = cargahoraria; this.horario = horario; this.sala = sala; } public integer getiddisciplina() { return id; } public void setiddisciplina(integer iddisciplina) { this.id = iddisciplina; } // ... }
but gives exception :
javax.el.propertynotfoundexception: class 'br.icmc.usp.modelo.disciplina' not have property 'id'. @ javax.el.beanelresolver.getbeanproperty(beanelresolver.java:664) @ javax.el.beanelresolver.getvalue(beanelresolver.java:293) @ javax.el.compositeelresolver.getvalue(compositeelresolver.java:188) @ com.sun.el.parser.astvalue.getvalue(astvalue.java:120) @ com.sun.el.parser.astvalue.getvalue(astvalue.java:167) @ com.sun.el.valueexpressionimpl.getvalue(valueexpressionimpl.java:224) @ org.apache.jasper.runtime.pagecontextimpl.evaluateexpression(pagecontextimpl.java:1009) @ org.apache.jsp.disciplina.editardisciplina_jsp._jspservice(editardisciplina_jsp.java:99) @ org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:111) @ javax.servlet.http.httpservlet.service(httpservlet.java:848) @ org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:403) @ org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:492) @ org.apache.jasper.servlet.jspservlet.service(jspservlet.java:378)
why receiving propertynotfoundexception
exception? wrong?
this seems el related error. not scriptlet code error. el works on getter setters.
change getter setter
public integer getiddisciplina() { return id; } public void setiddisciplina(integer iddisciplina) { this.id = iddisciplina; }
to
public integer getid() { return id; } public void setid(integer iddisciplina) { this.id = iddisciplina; }
Comments
Post a Comment