1. import java.util.HashMap;
  2. import java.util.Map;
  3. import java.util.Scanner;
  4. public class FormDebugger {
  5. public static void main(String[] args) {
  6. Scanner scanner = new Scanner(System.in);
  7. // Simulate form submission data (replace with actual data source)
  8. Map<String, String> formData = new HashMap<>();
  9. formData.put("name", "John Doe");
  10. formData.put("email", "john.doe@example.com");
  11. formData.put("age", "30");
  12. formData.put("city", "New York");
  13. System.out.println("Form Submission Debugger");
  14. System.out.println("--------------------------");
  15. // Pretty-print the form data
  16. prettyPrintFormData(formData);
  17. scanner.close();
  18. }
  19. public static void prettyPrintFormData(Map<String, String> formData) {
  20. // Iterate through the form data and print each field with a label
  21. for (Map.Entry<String, String> entry : formData.entrySet()) {
  22. String fieldName = entry.getKey();
  23. String fieldValue = entry.getValue();
  24. System.out.println("Field: " + fieldName);
  25. System.out.println("Value: " + fieldValue);
  26. System.out.println("---");
  27. }
  28. }
  29. }

Add your comment