java - Playframework 2.2: IllegalStateException: No value when invoking bindFromRequest -


in playframework 2.2.x, got error when trying binding form data pojo.

illegalstateexception: no value  

and here sample code:

form<orderrequest> form = new form<orderrequest>(orderrequest.class); final orderrequest orderrequest = form.bindfromrequest().get(); 

this article meant leave trail people suffer similar problem.

i answer myself later.

i wonder caused problem decided find out parameter might trigger problem.

here structure of orderrequest:

public class orderrequest {   private int num;   private boolean isadmin;   private string name;    ....  } 

i able narrow down 2 parameters, turned out when input parameter [num] null, doesn't recognize null type int, parameter [isadmin] type boolean, for these primitive data type, not nullable type.

to avoid situation, suggest checks type of each parameter, making sure setting value matches type.

as mentioned, primitive data type not nullable type.

one thing replacing primitive data type wrapper class, fix problem.

public class orderrequest {   private integer num;   private boolean isadmin;   private string name;    ....  } 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -