Form prepopulation java query not working properly