1. Use the background JSP to obtain the List of requests in the Servlet and assemble the data in the List into XML. The following code is displayed as xml in Eclipse's built-in browser. [Java]/**** news Servlet * @ author Xu Yue **/public class ListServlet extends HttpServlet {private static final long serialVersionUID = 1L; videprivate onewsservice vs = new VideoNewsServiceImpl (); protected void doGet (HttpServletRequest request, response) throws ServletException, IOException {doPost (request, response);} protected void doPost (HttpServletRequest request, response) throws ServletException, IOException {List <VideoNews> news =. readNews (); request. setAttribute ("lstnews", news); request. getRequestDispatcher ("/WEB-INF/pages/news. jsp "). forward (request, response) ;}}/*** news Servlet * @ author Xu Yue **/public class ListServlet extends HttpServlet {private static final long serialVersionUID = 1L; private VideoNewsService vs = new response (); protected void doGet (HttpServletRequest request, response) throws ServletException, IOException {doPost (request, response);} protected void doPost (HttpServletRequest request, httpServletResponse response) throws ServletException, IOException {List <VideoNews> news =. readNews (); request. setAttribute ("lstnews", news); request. getRequestDispatcher ("/WEB-INF/pages/news. jsp "). forward (request, response) ;}} [html] <% @ page language = "java" contentType = "text/xml; charset = UTF-8 "pageEncoding =" UTF-8 "%> <% @ taglib prefix =" c "uri =" http://java.sun.com/jsp/jstl/core "%> <? Xml version = "1.0" encoding = "UTF-8"?> <VideoNews> <c: forEach items = "$ {lstnews}" var = "n"> <news id = "$ {n. id} "> <title >$ {n. title} </title> <length >$ {n. timeLength }</length> </news> </c: forEach> </videoNews> <% @ page language = "java" contentType = "text/xml; charset = UTF-8 "pageEncoding =" UTF-8 "%> <% @ taglib prefix =" c "uri =" http://java.sun.com/jsp/jstl/core "%> <? Xml version = "1.0" encoding = "UTF-8"?> <VideoNews> <c: forEach items = "$ {lstnews}" var = "n"> <news id = "$ {n. id} "> <title >$ {n. title} </title> <length >$ {n. timeLength }</length> </news> </c: forEach> </videoNews> 2. the following error occurs in Firefox: XML parsing error: XML or text declaration does not start with an object. chrome reports an error: XML declaration allowed only at the start of the document. According to the error message, you can see the XML declaration. <? Xml version = "1.0" encoding = "UTF-8"?> It must start with the document. 3. Solve the problem by placing page, taglib, and xml at the same time in the first line, followed by one. It's hard to see, but it solves the problem.