简体   繁体   中英

jsp form returns null value in one input

JSP code:

<form method="POST" action="editing.jsp">
    <div class="line">
        <span class="Stk">Current Password:</span><input type="password" name='pass' />
    </div>

    <div class="line">
        <span class="Stk">New<br>Password:</span><input type="password" name='neopass' />
    </div>

    <div class="line">
        <span class="Stk">Confirm Password:</span><input type="password" name='passcon' />
    </div>
    <br>

    <div class="line">
        <input type="submit" value="Change Password"/>
    </div>
 </form>

.java code:

public class myUser {

    private String pass = null;
    private String neopass = null;
    private String passcon = null;

    public void myUser(){

    }

    public String getPass(){
        return this.pass;
    }

    public void setPass(final String pass){     
        this.pass = pass;
    }

    public String getPasscon(){
        return this.passcon;
    }

    public void setPasscon(final String passcon){
        this.passcon = passcon;
    }

    public String getneoPass(){
        return this.neopass;
    }

    public void setneoPass(final String neopass){
        this.neopass = neopass;
    }
}

I try to make a form so as I can change the password in my app ! The problem is that even though I think that I have done all right , something goes wrong an it doesn't work ! When I'm printing the values that I set in the form (through ) the values I had put in pass and passcon inputs appear normally, but the value in neopass input appears to be all the time ! ),我在passpasscon输入中输入的值会正常显示,但neopass输入中的值显示为一直为

Your method for neopass should be getNeopass() setNeopass() to match your neopass form item. (not setneoPass - wrong caps)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM