I want to convert a web form to a model in Java.
In C# I can write this:
<input name="id" value="" type="text"/>
public class Test
{
public int? Id{get;set;}
}
The id
can be null.
But in Java when using struts2 it throws an exception:
Method "setId" failed
So how to write this case in Java?
Integer
instead ofint
. – Hellas