Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring中忘记密码的垃圾URL实现_Spring_Jsp_Spring Mvc - Fatal编程技术网

Spring中忘记密码的垃圾URL实现

Spring中忘记密码的垃圾URL实现,spring,jsp,spring-mvc,Spring,Jsp,Spring Mvc,我正在开发一个SpringMVC应用程序。我想实现忘记密码功能。为此,我使用了秘密问题方法。我已经创建了一个JSP页面,在这里我接收用户名、secretanswer等值,然后检查这些值是否存在,然后保存用户提供的新密码。我在JSP页面上遇到问题,当我单击submit时,它会显示一些垃圾URL。我相信这是一个小小的错误,我看不出来。请告诉我出了什么问题 Apache tomcat错误URL: HTTP Status 404 - /id=0,%20username=null,%20password=

我正在开发一个SpringMVC应用程序。我想实现忘记密码功能。为此,我使用了秘密问题方法。我已经创建了一个JSP页面,在这里我接收用户名、secretanswer等值,然后检查这些值是否存在,然后保存用户提供的新密码。我在JSP页面上遇到问题,当我单击submit时,它会显示一些垃圾URL。我相信这是一个小小的错误,我看不出来。请告诉我出了什么问题

Apache tomcat错误URL:

HTTP Status 404 - /id=0,%20username=null,%20password=null
用于更改密码的控制器功能:

 @RequestMapping(value = "/forgotpassword")
    public String forgotPassword(Model model){
       model.addAttribute("person",new Person());
       return "forgotpassword";
    }

    @RequestMapping(value = "/changepassword")
    public String changepassword(@ModelAttribute("person") Person f,Model model){
        System.out.println("Did we reach here on submit");
        personService.checkAuthenticitiy(f.getUsername(), f.getSecretanswer(), f.getNewpassword());
        model.addAttribute("person", new Person());
        return "redirect:/forgotpassword";
    }
JSP页面:

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Forgot Passsword page</title>
</head>
<body>

<td><a href="<c:url value='/' />" >Go Home</a></td>

<h1>
    Change password
</h1>

<c:url var="addAction" value="/changepassword" ></c:url>
<form:form action="${person}" commandName="person">
<table>
        <tr>
            <td>
                <form:label path="username">
                    <spring:message text="username"/>
                </form:label>
            </td>
            <td>
                <form:input path="username"  />
            </td>
        </tr>
        <tr>
            <td>
                <form:label path="secretquestion" >
                    <spring:message text="secretquestion"/>
                </form:label>
            </td>
            <td>
                <form:input path="secretquestion"/>
            </td>
        </tr>
        <tr>
            <td>
                <form:label path="secretanswer" >
                    <spring:message text="secretanswer"/>
                </form:label>
            </td>
            <td>
                <form:input path="secretanswer"/>
            </td>
        </tr>
    <tr>
        <td>
            <form:label path="newpassword" >
                <spring:message text="newpassword"/>
            </form:label>
        </td>
        <td>
            <form:input path="newpassword"/>
        </td>
    </tr>
        <tr>
            <td>
                <input name="submit" type="submit" value="Submit" />
            </td>
        </tr>
        </table>
    </form:form>
</body>
</html>

应该是

<c:url var="addAction" value="/changepassword" ></c:url>
 <form:form action="${addAction}" commandName="person">


人不是你的行动

谢谢你,普拉文,我明天会试试,因为我不在办公室了。你确定这是唯一的错误吗?是的,我觉得其他一切都很完美。${person}没有任何requestMapping,因此它会导致这样的错误不需要感谢,您可以分享其他问题。其他问题是我使用Bcrypt创建加密的秘密答案,结果,Bcrypt总是创建不同的加密文本…facepalm。。。其已解决、已更改的算法:-)嗨,普拉文,你能看看这个问题吗。
<c:url var="addAction" value="/changepassword" ></c:url>
<form:form action="${person}" commandName="person">
<c:url var="addAction" value="/changepassword" ></c:url>
 <form:form action="${addAction}" commandName="person">