If you are responsible for creating the form, you might want to look into
the XForms project. That is probably more complex than you wanted
Much more likely approach is to create a POJO (Plain Old
Java Object) that can take the request parameter Map and initialize the variables, and also write formated XML text to an output stream.
Bill