I have an action URL after clicking a hyper link like so
/SocialStupendous/GetProfile.action?slno=3&slno=3
In my execute
method of ActionClass
I have the following code
public String execute() {
int urislno=Integer.parseInt(getServletRequest().getParameter("slno"));
System.out.println(urislno);
bean.setUslno(urislno);
}
I am getting NullPointerException
when I am performing bean.setuslno(urislno)
. Even though urislno
is printed properly as 3
.
ProfileBean
class:
public class ProfileBean {
private int uslno;
public int getUslno() {
return uslno;
}
public void setUslno(int uslno) {
this.uslno = uslno;
}
}
Why is this happening?
See Question&Answers more detail:os