j_security_check没有重定向到正确的jsp

时间:2016-12-14 22:05:59

标签: java jsp web.xml

我一直在玩{ "dishes": [ { "_id": "584ae32eb4e5ec277c8dbcab", "name": "Uthapizza", "price": 499, "image": "images/uthapizza.png" }, { "_id": "584ae346b4e5ec277c8dbcb1", "name": "Zucchipakoda", "price": 199, "image": "images/zucchipakoda.png" }, { "_id": "584ae359b4e5ec277c8dbcb7", "name": "Vadonut", "price": 199, "image": "images/vadonut.png" } ], "sum": 8.97, "postedBy": "584ae0ca2e678112b03f8a47", "_id": "58519897c777f922646a5215" } 和jsp页面。当我单独点击页面时,它们似乎都可以正常工作,但无论何时我登录它都应该将我重定向到我的j_security_check但是它只是将我发送到/index.jsp,这给了我一个/,因为它不存在。

这是我到目前为止的代码:

的web.xml

404

的login.jsp

<web-resource-collection id="WebResourceCollection_1">
    <web-resource-name>Management</web-resource-name>
    <url-pattern>/index.jsp</url-pattern>
    <url-pattern>/login.jsp</url-pattern>
    <url-pattern>/error.jsp</url-pattern>
</web-resource-collection>
<!-- Login -->
<login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
        <form-login-page>/login.jsp</form-login-page>
        <form-error-page>/error.jsp</form-error-page>
    </form-login-config>
</login-config>
<!-- Welcome Files -->
<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

的index.jsp

<form id="login" method="POST" action="j_security_check">

    <h1>Platform Sign-On</h1>
    <fieldset id="inputs">
        <input id="username" type="text" name="j_username" placeholder="Username" autofocus required>
        <input id="password" type="password" name="j_password" placeholder="Password" required>
    </fieldset>
    <fieldset id="actions">
        <input type="submit" id="submit" value="Log in">
    </fieldset>

</form>

根据要求,文件夹结构为:

<!DOCTYPE html>
<html lang="en">
    <div> HELLO WORLD </div>
</html>

有什么想法吗?我一直试图弄清楚为什么他们不会重定向成功或不成功的登录。根据我所阅读的资源,似乎所有内容都已到位,但它们似乎无法连接。

0 个答案:

没有答案