Saturday, December 10, 2011

Render parameter key or value must not be null or values be an empty array.

This error occurs when we store render parameters in Java Array. Generally, we store all the render parameters in separate Java String object which are working perfectly fine.

I tried this once with Java Array when I have more than 10 render parameters. I received the same error mentioned in subject line of post. The complete line of error is,

java.lang.IllegalArgumentException: Render parameter key or value must not be null or values be an empty array.

This issue occurred due to internal implementation of this method. It returns the value of a request parameter as a String, or null if the parameter does not exist.

If I try the line below for receiving render parameter, we will receive the same error.

String[] arrUserDetails1 = new String[2];
arrUserDetails[0] = request.getParameter("txtUserName");

If I try the line below for recieving render parameter, This will be working fine.

String[] arrUserDetails1 = new String[2];
String userName = request.getParameter("txtUserName");
arrUserDetails[0] = userName;

The conclusion is, render parameters can not store in to empty java array.