How does one convert an empty string to an int using Struts2. When the application encounters this parameter with no value, like from an empty text field, it throws the following exception.
java.lang.NoSuchMethodException:
com.XXXXXXXXXXXX.setID([Ljava.lang.String;)
Where ID is an integer, and the URL is:
Something.action?ID=&other=rawr
Is there a way to do this without using an Integer (class)? Do I have to write a type converter?
If you declare your id parameter as Integer struts will convert the empty string to null.
From : http://struts.apache.org/2.0.14/docs/type-conversion.html#TypeConversion-NullandBlankValues