|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Junior Member
Iscritto dal: Apr 2010
Messaggi: 8
|
[Java] servlet e login
Salve, stò realizzando un progetto con Netbeans. Per creare una sessione per gli utenti ho fatto così:ho una pagina html che chiede user e pws con una form, poi richiala una servlet di login, questa nel metodo post fa questo
String username = request.getParameter("username"); String password = request.getParameter("password"); Socio s = login.executeLogin(username, password); if(s==null) response.sendRedirect("index.html"); HttpSession sessione = request.getSession(true); sessione.setAttribute("socio", s); if(s.getUsername().equals("admin")) response.sendRedirect("Gestione.jsp"); else response.sendRedirect("Personale.jsp"); dove login è preso da GestoreLoginLocal che è una servlet con questo codice @Stateless public class GestoreLogin implements GestoreLoginLocal { @PersistenceContext private EntityManager em; public Socio executeLogin(String username, String password) { Socio s = em.find(Socio.class, username); if(s == null){ return null; } else{ if (!(s.getPassword().equals(password))) return null; else{ return s; } } } } ma se provo a fare la login mi dà questo errore: The server encountered an internal error () that prevented it from fulfilling this request. exception javax.ejb.EJBException il database è corretto e si connette, inoltre usando una servlet di login modificata, cioè senza sessione funziona. Dove è l'errore? può essere il find? Ci provo da ieri, help me!!! |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 15:13.



















