i know this question has been asked a lot of time, but i can't really understand how to get it. I made a little servlet that, after login form, set a stateful session bean (wich retrieve the entity) and redirect the user to home. The Servlet works so:
@EJB
private SessionCart ses;
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String email = request.getParameter("email");
String password = request.getParameter("password");
ses.login(email, password);
}
now, the SessionCart has a method who give back username (the method is .getNome()) and i would like to pass it trought http while the user is redirected to home. I could use the request object to redirect, but i get the homepage in the (example i have the servlet in the URL localhost:8080/web/form/login and i get the homepage in the address localhost:8080/web/form/login, but it could be in localhost:8080/web/ or the browser will not recognize images and others elements). How could i get this working?
Update: Some code about SessionCart for @developerwjk
@Stateful
@LocalBean
public class SessionCart {
@Resource
private SessionContext context;
@PersistenceContext(unitName="ibeiPU")
private EntityManager manager;
private LinkedList<Vendita> carrello;
private LinkedList<Integer> quantita;
private Persona utente;
/*
* Business methods
*/
}