Click to See Complete Forum and Search --> : Enumeration or something better?


florida
10-25-2007, 04:32 PM
I have a JSP Form with 25 inputs that is processed and emailed to people.

I am using Enumeration to process and display the information. But I need exact order of how the information is displayed and Enumerations do not guarantee order so I have to do this:


Enumeration params = request.getParameterNames();
String text = "Form Information\n\n";
while (params.hasMoreElements()) {
//String name = (String)params.nextElement();
//String[] values = (String[])request.getParameter(name);
//String value = request.getParameter(name);
text += "First Name: " + request.getParameter("firstName");
text += "Last Name: " + request.getParameter("lastName");
text += "City: " + request.getParameter("city");
text += "County: " + request.getParameter("county");
text += "Project Info: " + request.getParameter("projInfo");
text += "Main Status: " + request.getParameter("mainStatus");
.....
.....
/*
if (values != null && values.length > 0) {
for (int i=0; i<values.length; i++) {
text += values + " ";
}
}
*/
}

//email the info
..........
EmailSender emailSender = new EmailSender();
emailSender.setFromEmail("info@company.com");
emailSender.setSubject(emailSubject);
emailSender.setText(text);
.........


Any better way to list the information?