timothy61981
New Member
After creating a Dynamic Web Project in Eclipse, I created some JavaBean classes and for each class a JSP file, which will return an XML.Such as:The bean:\[code\]package com.beans;public class Program { private String programID = "123"; private String programName = "Morning show"; private String startTime = "1365238800"; private String endTime = "1365242400"; public String getProgramID() { return this.programID; } public String getProgramName() { return this.programName; } public String getStartTime() { return this.startTime; } public String getEndTime() { return this.endTime; }}\[/code\]The Jsp: \[code\]<?xml version="1.0" encoding="ISO-8859-1"?><%@ page contentType="text/xml;charset=ISO-8859-1" %><jsp:useBean id="programXML" class="com.beans.Program"/><Program> <ProgramName><% out.print(programXML.getProgramID()); %></ProgramName> <ProgramType><% out.print(programXML.getProgramName()); %></ProgramType> <startTime><% out.print(programXML.getStartTime()); %></startTime> <endTime><% out.print(programXML.getEndTime()); %></endTime></Program>\[/code\]The server returns the following example for the \[code\]http://localhost:8080/Project/Program.jsp\[/code\] request: \[code\] <Program> <ProgramName>123</ProgramName> <ProgramType>Morning show</ProgramType> <startTime>1365238800</startTime> <endTime>1365242400</endTime> </Program>\[/code\]Which is the XML I expected. Now, I would like to modify the bean/jsp file to receive an XML which contains arrays too, like the following structure:\[code\]<ProgramList> <Program> ... </Program> <Program> ... </Program></ProgramList>\[/code\]Can you give me advices how to modify the bean/jsp?