Tomcat indicates error:
org.apache.jasper.JasperException: An exception occurred processing JSP page /AccueilEmploye.jsp at 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 is the 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 the problem, Error says that the property idemp isnt available in the bean, while it is 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 is the part of the servlet that sends the object emp to the 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 the problem might be in the getter of the attribute you're trying to access. The newest jsp ${...}
syntax accesses the attribute throught it's getter. So, if you want to access attribute idemp
in jsp using ${masession.idemp}
, you need to have a getter named getIdemp()
in the respectful class.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.