gimbo
gimbo

Reputation: 67

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 Beans.'nameofmethod' (e.g. Bean.getneoPass())) the values I had put in pass and passcon inputs appear normally, but the value in neopass input appears to be null all the time !

Upvotes: 0

Views: 1023

Answers (1)

Gas
Gas

Reputation: 18050

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

Upvotes: 2

Related Questions