473,403 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Enumeration issue

I have a JSP Form with 15 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:
Expand|Select|Wrap|Line Numbers
  1. Enumeration params = request.getParameterNames();
  2. String text = "Form Information\n\n";
  3. while (params.hasMoreElements()) {
  4. //String name = (String)params.nextElement();
  5. //String[] values = (String[])request.getParameter(name);
  6. //String value = request.getParameter(name);
  7. text += "First Name: " + request.getParameter("firstName");
  8. text += "Last Name: " + request.getParameter("lastName");
  9. text += "City: " + request.getParameter("city");
  10. text += "County: " + request.getParameter("county");
  11. text += "Project Info: " + request.getParameter("projInfo");
  12. text += "Main Status: " + request.getParameter("mainStatus");
  13. .....
  14. .....
  15. /*
  16. if (values != null && values.length > 0) {
  17. for (int i=0; i<values.length; i++) {
  18. text += values + " ";
  19. }
  20. }
  21. */
  22. }
  23.  
  24. //email the info
  25. ..........
  26. EmailSender emailSender = new EmailSender();
  27. emailSender.setFromEmail("info@company.com");
  28. emailSender.setSubject(emailSubject);
  29. emailSender.setText(text);
  30. .........

Any better way to list the information?
Please advise because I dont have Struts and probably wont be allowed to get it for a long time.
Oct 25 '07 #1
4 1287
JosAH
11,448 Expert 8TB
You should've created a simple class for that first name, last name, city etc.
Don't stick them in as attributes which have nothing to do with each other.

kind regards,

Jos
Oct 25 '07 #2
You should've created a simple class for that first name, last name, city etc.
Don't stick them in as attributes which have nothing to do with each other.

kind regards,

Jos
Thanks,

You mean JavaBean class with getter and setter methods???
Oct 25 '07 #3
JosAH
11,448 Expert 8TB
Thanks,

You mean JavaBean class with getter and setter methods???
Yup, those beanies alright. Your JSP pages like them and it takes off the burden
of remembering 'an order' of certain properties.

kind regards,

Jos
Oct 25 '07 #4
Thanks for your quick responses.

I will try it with JSP and JavaBeans as you suggested.
Oct 25 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Justin Wright | last post by:
I know that I can set up an enumeration as follows ( just typed in quick so may have syntax errors ): <xsd:simpleType name="colors"> <xsd:restriction base="xsd:string"> <xsd:enumeration...
3
by: Sampson | last post by:
I have a question about enumeration and how to populate them during runtime. I am using vb.net but will happily take any advice in c# as well. Here is an example to help illustrate what I am...
0
by: p | last post by:
I am wirting an applications where I use Roles. My roles are held in an SQL Table where the fields are simply RolID and RoleName. I am writing the Application in ASP.NET. I assign the roles to...
10
by: braratine | last post by:
Hello, I have to following issue. A type is declared based on an enum: " enum TpAddressPlan { P_ADDRESS_PLAN_NOT_PRESENT = 0, P_ADDRESS_PLAN_UNDEFINED = 1, P_ADDRESS_PLAN_IP = 2,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.