jsp - Tomcat error: bean's property cant be found -
tomcat indicates error:
org.apache.jasper.jasperexception: exception occurred processing jsp page /accueilemploye.jsp @ line 10 7: <body> 8: <p> 9: accueil pour:${masession.type }<br> 10: votre id: ${masession.idemp }<br> 11: bienvenu<br> 12: ${message}<br> 13: email: ${masession.email }<br>
this accueilemploye.jsp file.
<body> <p> accueil pour:${masession.type }<br> votre id: ${masession.idemp }<br> <%-- error here --%> bienvenu<br> ${message}<br> email: ${masession.email }<br> mot de passe: ${masession.mdp}<br> nom: ${masession.nom}<br> prenom: ${masession.prenom }<br> departement:${masession.dept } </p> </body>
can't figure out where's problem, error says property idemp isnt available in bean, while there.
public class utilisateur { private string nom; private string prenom; private string email; private string dept; private string poste; private string agence; private string mdp; //private int id_emp; private string type; private timestamp date_inscr; private int idemp;
this part of servlet sends object emp view ( jsp )
else { msg=""; request.setattribute("message", msg); session.setattribute("masession", emp); if (emp.gettype().equals(employe)){ vue="/accueilemploye.jsp"; } else if (emp.gettype().equals(technicien)){ vue="/accueiltechnicien.jsp"; } else if (emp.gettype().equals(technicienr)){ vue="/accueiltechnicienr.jsp"; } else if (emp.gettype().equals(admin)){ vue="/accueiladmin.jsp"; } this.getservletcontext().getrequestdispatcher(vue).forward(request, response); }
i think problem might in getter of attribute you're trying access. newest jsp ${...}
syntax accesses attribute throught it's getter. so, if want access attribute idemp
in jsp using ${masession.idemp}
, need have getter named getidemp()
in respectful class.
Comments
Post a Comment