2016-02-26 122 views
0

我在chrome中運行本地主機時遇到此錯誤。錯誤=>第2行第1列錯誤:文檔末尾的額外內容

我的jsp的程序:在鍍鉻

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 
<%@page contentType="application/xml" trimDirectiveWhitespaces="true" %> 

<c:choose> 
    <c:when test='${param.event == "NewCall"}'> 
     <%    
     String moderator_no1 =request.getParameter("moderator_no"); 
     String participant_no = request.getParameter("participant_no"); 
     String conference_id = request.getParameter("conference_id"); 
     System.out.println("New call"); 
     out.print("<?xml version=\"1.0\" encoding=\"UTF-8\"?><response><conference moderator=\"true\" caller_onhold_music=\"default\" record=\"true\">"+conference_id+"</conference></response>"); 
     System.out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?><response><conference moderator=\"true\" caller_onhold_music=\"default\" record=\"true\">"+conference_id+"</conference></response>"); 
     session.setAttribute("state", "conferenceStarted"); 
     %> 
    </c:when> 
    <c:when test='${(param.event == "Conference" || param.event == "Hangup" || param.event == "Disconnect")}' > 
     <%   
      out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?><response></response>"); 
      String session_id = request.getParameter("sid"); 
      out.println(session_id); 
      System.out.println(session_id); 
      String called_no = request.getParameter("cid"); 
      System.out.println(called_no); 
      out.println(called_no); 
      String actualtime = request.getParameter("total_call_duration"); 
      out.println(actualtime); 
      System.out.println(actualtime); 
      String start_time = request.getParameter("start_time"); 
      out.println(start_time); 
      System.out.println(start_time); 
      String end_time = request.getParameter("time"); 
      out.println(end_time); 
      System.out.println(end_time); 
     %> 
    </c:when> 
</c:choose> 

錯誤輸出:

This page contains the following errors: 

error on line 2 at column 1: Extra content at the end of the document 
Below is a rendering of the page up to the first error. 

我能在我的日誌文件打印空當我給事件=會議,但在Chrome我收到上述錯誤。

請幫幫我。

+0

解決了這個問題? –

回答

0

原因是,

param.event == "Conference"

首先響應打印

<?xml version="1.0" encoding="UTF-8"?><response></response> 

然後打印一些其它變量等,

SESSION_ID,called_no,actualtime等

所以最後是xml migh看起來像這樣

<?xml version="1.0" encoding="UTF-8"?><response></response> 123456xyz 

這將導致error: Extra content at the end of the document

你必須決定如何解決這個問題。

相關問題