person.setSurname(request.getParameter("surname"));
person.setAge( Integer.parseInt(request.getParameter("age")) );
while(request.getParameter(phone)!=null)
{
phones.add(new Phone( request.getParameter(phone) ));
phone = "phone["+i+"].phone";
i++;
}
if (!phones.isEmpty())