Statement object returning null
I have defined a function in a bean and call that function from a servlet by instantiating the bean.But this function is returning null.Record gets updated in the database but instead of entering the value it updates it with null.
Value is also getting passed through jsp page in the servlet in this way.
String address=request.getParameter("addressTextBox");
UserBean userbean=new UserBean();
userbean.setUserID(s_conIdText);
userbean.setAddress(address);
userbean.updateAddress(stmt,userbean);
-
this is the function which I have defined in the bean class.
public void updateAddress(Statement stmt,UserBean userbean) throws Exception{
try{
String sqlstr="update usertbl set address = '"+userbean.getAddress()+"' where userId ='"+userbean.getUserID()+"'";
stmt.executeUpdate(sqlstr);
}catch(Exception e){
throw new Exception("UpdateError.."+e.getMessage());
}
}
Record gets updated with null.
As such no error or exception has been generated.
--
Rest all the operations are being performed successfully

