TEI uses Jakarta EE’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/LuisAMoralesA/tallerIngles-UAEMEcatepec/llms.txt
Use this file to discover all available pages before exploring further.
HttpSession mechanism to maintain user authentication state across page requests. Sessions time out after 30 minutes of inactivity, as configured in web.xml. Every protected JSP checks for a valid session on load and redirects to a dedicated expiration page if the session is missing or has been invalidated.
Configuración del timeout
The session timeout is declared in the application’s deployment descriptor. This is the only session configuration in the project — no programmatic override is used.web.xml
/view/sesionExpirada.jsp.
Atributos de sesión
The following session attributes are read and written by servlets and JSPs throughout the application. All attributes are of typeString.
| Atributo | Tipo | Descripción |
|---|---|---|
sesionIniciada | String | Nombre de usuario del usuario autenticado. Set at login by the role servlet (loginAdmin, loginTeacher, loginStudent). Present for the entire authenticated session. |
rango | String | Role string for the authenticated user (ADMINISTRADOR, PROFESOR, or ESTUDIANTE). Set by the role dashboard JSPs (menuAdministrador.jsp, menuProfesor.jsp, menuAlumno.jsp) after querying the users table — not set by the login servlets directly. |
errorMessage | String | Mensaje de error de login. Set when USUARIO_NO_ENCONTRADO or DATO_INCORRECTO is returned; read and displayed by the SweetAlert error modal on the login JSP. |
actualizacionCompleta | String | Mensaje de confirmación de operación CRUD. Set after a successful add, update, or delete operation to display a confirmation popup on the next page load. |
userNameRegistrado | String | Username del usuario creado/encontrado. Set by addStudent, addTeacher, and addAdmin servlets to surface the generated or existing username to the administrator. |
iconoVentana | String | Tipo de icono SweetAlert2 a mostrar: success, warning, o error. Controls which visual style the popup uses after a CRUD operation. |
contraseñaIncorrecta | String | Error en validación de contraseñas al registrar. Set when the two password fields do not match during registration; triggers the mismatch error modal on redirect. |
Comprobación de sesión en JSPs
Every protected JSP in the application begins with a session guard scriptlet. The guard runs before any HTML is rendered and immediately redirects the user to the expiration page if the session is absent or does not contain thesesionIniciada attribute.
The pattern used across all role dashboards (menuAdministrador.jsp, menuAlumno.jsp, menuProfesor.jsp, and every sub-page) is:
JSP session guard
Constantes.VentanasJSP.URL_SESION_EXPIRADA resolves to /tallerDeInglesUAEM/view/sesionExpirada.jsp. The return statement after sendRedirect is mandatory in JSP scriptlets — without it the page would continue rendering below the redirect.sesionIniciada and uses it to query the database for the current user’s profile data (name, role, group, etc.).
Cerrar sesión
ThecerrarSesion servlet (mapped to /cerrarSesion) handles logout for all three roles. It reads the rango session attribute to determine the correct post-logout redirect URL, then calls session.invalidate() to destroy the session server-side.
cerrarSesion.java
| Condición | Redirect destino |
|---|---|
rango = ESTUDIANTE | Constantes.VentanasJSP.URL_LOGIN_ALUMNO |
rango = ADMINISTRADOR | Constantes.VentanasJSP.URL_LOGIN_ADMIN |
rango = PROFESOR | Constantes.VentanasJSP.URL_LOGIN_TEACHER |
Session exists but rango is null | Constantes.VentanasJSP.URL_INDEX |
No active session (sesion == null) | Constantes.VentanasJSP.URL_SESION_EXPIRADA |
/cerrarSesion is present in all three side navigation menus (menuLateralAdministradores.jsp, menuLateralAlumnos.jsp, menuLateralProfesores.jsp).
Página de sesión expirada
The dedicated expiration page at/view/sesionExpirada.jsp is the landing point for all unauthenticated access attempts. It displays a visual indicator image (sesionExpirada1.png) and a descriptive message, then offers a button to navigate back to the appropriate entry point.
The page inspects the rango session attribute to decide where the button links:
- If
rangois present (the session still exists butsesionIniciadawas missing), the button text becomes “Volver a la sesion” and points to the corresponding role dashboard, so returning users with a partially-valid session are not stranded. - If no
rangois found, the button text becomes “Volver a Inicio” and points to the public index page (index.html).