Code:
for ( int i = 1; i <= 4; ++i )
{
string value = request.getParameter("box" + i);
if ( value ???? what condition are you looking for ??? )
{
...
}
}
One thing we added early on to a Utility class (bean) were methods safeGetParameter(request,name) and safeGetIntParameter(request,name) and then used try...catch in those methods to ensure that we handled null and non-numeric values in predictable ways, as appropriate. [names are obviously up to you...and our methods were static, so we had to keep passing the Request object...might be better to always init the bean on the page by passing Request and Response to it so you don't have to pass them as arguments.]