Ho realizzato due pagine jsp. La prima(Login.jsp) prende dei parametri dal'utente e passa alla seconda(salvanomesessione) che mette questi parametri dentro una sessione e poi chiama un servlet. E' possibile fare tutto tramite una sola jsp,inserendo tutto detro Login?
E come?
codice:<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Login</title> </head> <body> <form action=salvanomesessione.jsp method="post"> <table> <tr> <td> Username </td> <td> <input type="text" name="username"/> </td> </tr> <tr> <td> Password </td> <td> <input type="password" name="password"/> </td> </tr> <tr> <td> <input type="submit" name="Login" value="Login"/> </td> </tr> </table> </form> </body> </html>codice:<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <% String nomeutente=request.getParameter("username"); if(nomeutente==null) nomeutente=""; String passwordutente=request.getParameter("password"); if(passwordutente==null) passwordutente=""; session.setAttribute("nomeutente",nomeutente); session.setAttribute("passwordutente",passwordutente); %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> <script language='javascript'> function esegui() { document.forms[0].submit(); } </script> </head> <body onLoad='esegui()'> <form myform name='invio' action='Manager' method='post'> Attendi .. </form> </body> </html>

Rispondi quotando
