Struts2 converting empty string parameter to an "int"

Posted by Kyle Partridge on Stack Overflow See other posts from Stack Overflow or by Kyle Partridge
Published on 2010-06-10T01:23:09Z Indexed on 2010/06/10 1:32 UTC
Read the original article Hit count: 293

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about struts2