Non capisco perchè facendo più login, Struts crea un'unica sessione! Forse con il codice riesco a spiegarmi meglio!
struts-config.xml:
codice:<struts-config> <form-beans> <form-bean name="loginForm" type="org.apache.struts.action.DynaActionForm" > <form-property name="user" type="java.lang.String"></form-property> <form-property name="password" type="java.lang.String"></form-property> </form-bean> </form-beans> <action-mappings> <action path="/login" type="actions.ActionLogin" name="loginForm" scope="request"> <forward name="continua" path="/result.jsp"/> </action> </action-mappings> </struts-config>
ActionLogin.java
Aprendo due o più Explorer e loggandomi, l'ID Session che mi restituisce è sempre lo stesso ... e dovrebbe essere diverso!!!codice:public class ActionLogin extends Action { public ActionForward execute(ActionMapping mapp, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws Exception { System.out.println("Action ref = " + this); System.out.println("Form ref = " + form.hashCode()); DynaActionForm login=(DynaActionForm)form; LoginVO loginVO= new LoginVO(); loginVO.setUser(login.getString("user")); loginVO.setPassword(login.getString("password")); HttpSession session = req.getSession(); // Restituisce sempre la stessa sessione.... ma dovrebbe cambiare // per ogni utente che si logga! PERCHE' non cambia??? System.out.println("ID Sessione: "+ session.getId()); System.out.println("##################################################"); return mapp.findForward("continua"); } }
Cosa sbaglio???
Grazie!

Rispondi quotando
