问题描述
我有一个简单的HTML登录页面, userID
,密码
字段,用html
编写,代码如下所示:
< ; form class =login-boxname =loginFormaction =j_spring_security_check>
< div class =login-wrapper>
< div class =box>
< div class =content-wrap>
< div style =text-align:center>< img height =width =src =resources / images / demo.logo.000.jpg>< / div> ;
< h1>登入< span>< img height =width =src =resources / images / demo.logo.jpg> <坐席> TM< / SUP>< /跨度>< / H1>
< input class =form-controltype =textname =j_usernameplaceholder =User ID>
< input class =form-controltype =passwordname ='j_password'placeholder =Password>
< input class =logintype =submitvalue =Sign informmethod =post/>
< div class =alert alert-error>
<! - 此处的错误讯息 - >
< / div>
< / div>
< / div>
< / div>
< / form>
现在我通过拦截器调用这个页面,但它给出了警告:
警告:找不到匹配的处理程序方法找到servlet请求:路径'/WEB-INF/pages/home.html',方法'GET',参数映射[[空]]
和finnalyy无法呈现给服务器错误
** HTTP状态404 -
类型状态报告
消息
说明请求的资源不可用。
VMware vFabric tc Runtime 2.9.2.RELEASE / 7.0.39.B.RELEASE **
以下是我的xml配置
< bean id =viewResolver
class =org。 springframework.web.servlet.view.InternalResourceViewResolver>
< property name =prefixvalue =/ WEB-INF / pages //>
< property name =suffixvalue =。html/>
< / bean>
这是我的web.xml:
< servlet的>
< servlet-name> mvc-dispatcher< / servlet-name>
< servlet-class> org.springframework.web.servlet.DispatcherServlet< / servlet-class>
1< / load-on-startup>
< / servlet>
< servlet-mapping>
< servlet-name> mvc-dispatcher< / servlet-name>
< url-pattern> /< / url-pattern>
< / servlet-mapping>
< 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>
< listener>
< listener-class> org.springframework.web.context.ContextLoaderListener< / listener-class>
< / listener>
< context-param>
< param-name> contextConfigLocation< / param-name>
< param-value>
/WEB-INF/mvc-dispatcher-servlet.xml
/WEB-INF/spring-security.xml
< /参数值>
< / context-param>
< / web-app>
spring-security.xml:
<安全:HTTP>
< security:intercept-url pattern =/ welcomeaccess =ROLE_USER/>
< security:form-login login-page ='/ Login'default-target-url =/ success
login-processing-url =/ j_spring_security_check
authentication-failure -url = / WEB-INF /页/错误的Login.jsp =真?/>
< / security:http>
我错过了什么...... ??
authentication-failure -url =/ WEB-INF / pages / Login.jsp?error = true/>
不应该。 。
authentication-failure-url =/ WEB-INF / pages / Login。** html **?error = true />
Issue:
I have a simple HTML login page that a userID
, Password
fields and that is written in htmlthe code is shown below:
<form class="login-box" name="loginForm" action="j_spring_security_check">
<div class="login-wrapper">
<div class="box">
<div class="content-wrap">
<div style="text-align:center"><img height="" width=""src="resources/images/demo.logo.000.jpg"></div>
<h1>Login to <span><img height="" width=""src="resources/images/demo.logo.jpg"> <sup>TM</sup></span></h1>
<input class="form-control" type="text" name="j_username" placeholder="User ID">
<input class="form-control" type="password" name='j_password' placeholder="Password">
<input class="login" type="submit" value="Sign in" formmethod="post"/>
<div class="alert alert-error">
<!-- Error Messages here -->
</div>
</div>
</div>
</div>
</form>
now i am calling this page by interceptor but it gives the Warning as:
WARNING: No matching handler method found for servlet request: path '/WEB-INF/pages/home.html', method 'GET', parameters map[[empty]]
and finnalyy failed to render giving server error as
**HTTP Status 404 -
type Status report
message
description The requested resource is not available.
VMware vFabric tc Runtime 2.9.2.RELEASE/7.0.39.B.RELEASE**
but when i change my Login.html to login.jsp it works fine.following are my xml configurations
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/pages/" />
<property name="suffix" value=".html" />
</bean>
this is my web.xml:
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>mvc-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<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>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/mvc-dispatcher-servlet.xml
/WEB-INF/spring-security.xml
</param-value>
</context-param>
</web-app>
spring-security.xml:
<security:http>
<security:intercept-url pattern="/welcome" access="ROLE_USER"/>
<security:form-login login-page='/Login' default-target-url="/success"
login-processing-url="/j_spring_security_check"
authentication-failure-url="/WEB-INF/pages/Login.jsp?error=true"/>
</security:http>
am i missing something ....??
Can you check the entry in spring-security.xml ?
authentication-failure-url="/WEB-INF/pages/Login.jsp?error=true"/>
Shouldn't it...
authentication-failure-url="/WEB-INF/pages/Login.**html**?error=true"/>
这篇关于无法通过弹簧安全来呈现.html,而.jsp工作正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!