为什么JSSessionID没有在我的jsp源代码中生成?
我正在尝试使用Spring security login,下面是login.jsp,当我在两个不同的应用程序中运行相同的jsp时,一个应用程序没有生成jsessionid,导致404错误,另一个应用程序正在生成jsessionid并正常工作。你能帮我解决这个问题吗为什么JSSessionID没有在我的jsp源代码中生成?,jsp,spring-security,http-status-code-404,jsessionid,Jsp,Spring Security,Http Status Code 404,Jsessionid,我正在尝试使用Spring security login,下面是login.jsp,当我在两个不同的应用程序中运行相同的jsp时,一个应用程序没有生成jsessionid,导致404错误,另一个应用程序正在生成jsessionid并正常工作。你能帮我解决这个问题吗 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@page session="true"%> <html> <
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page session="true"%>
<html>
<head>
<title>Login Page</title>
</head>
<body onload='document.loginForm.username.focus();'>
<h1>Spring Security Custom Login Form (XML)</h1>
<div id="login-box">
<h3>Login with Username and Password</h3>
<c:if test="${not empty error}">
<div class="error">${error}</div>
</c:if>
<c:if test="${not empty msg}">
<div class="msg">${msg}</div>
</c:if>
<form name='loginForm'
action="<c:url value='/j_spring_security_check'/>" method='POST'>
<table>
<tr>
<td>User:</td>
<td><input type='text' name='username'></td>
</tr>
<tr>
<td>Password:</td>
<td><input type='password' name='password' /></td>
</tr>
<tr>
<td colspan='2'><input name="submit" type="submit"
value="submit" /></td>
</tr>
</table>
<input type="hidden" name="${_csrf.parameterName}"
value="${_csrf.token}" />
</form>
</div>
</body>
</html>
登录页面
Spring安全自定义登录表单(XML)
使用用户名和密码登录
${error}
${msg}
用户:
密码:
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>IAuthor</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>IAuthor</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/IAuthor-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>IAuthor</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-security.xml
</param-value>
</context-param>
<!-- Spring Security -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
作者
index.html
作者
org.springframework.web.servlet.DispatcherServlet
上下文配置位置
/WEB-INF/iauther-servlet.xml
1.
作者
*.html
org.springframework.web.context.ContextLoaderListener
上下文配置位置
/WEB-INF/spring-security.xml
springSecurityFilterChain
org.springframework.web.filter.DelegatingFilterProxy
springSecurityFilterChain
/*
你能给我看看你的web.xml
我已经用web.xml更新了“一个应用程序没有生成jsessionid,导致404错误”这个结论没有任何意义。我猜你只是误解了真正的问题。请准确描述正在发生的事情和没有发生的事情。而且,“生成JSSessionID”相当模糊。请使用适当的术语。如果您不能,请澄清具体的业务/功能要求。