Thursday, 8 August 2013

Getting NULL for empty values in ModelDriven

Getting NULL for empty values in ModelDriven

ModelDriven returns NULL for the params witch have empty value.
Bean
public class MyBean
{
private String userName;
public void setUserName(String userName)
{
this.userName = userName;
}
public String getUserName()
{
return userName;
}
}
Class
public class MyAction extends ActionSupport implements ModelDriven<MyBean>
{
MyBean myBean = new MyBean();
public String execute()
{
System.out.println(myBean.getUserName());//getting null here
return "SUCCESS";
}
}
Request
/home/MyAction.do?userName=&pass=
Hear I am passing empty value for userName param but in action I getting
the null value.
How to get exact value in ModelDriven ?

No comments:

Post a Comment