简体   繁体   English

我在Jsp中生成xml文件时,JSP中的表达语言无法正常工作

[英]Expression Language in JSP not working while i am generating a xml file in Jsp

In My Jsp Page(name.jsp) 在我的Jsp页面中(name.jsp)

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page contentType="text/xml" %><%@ page isELIgnored="false" %> 
<?xml version="2.5" encoding="UTF-8" standalone="no"?>
<document type="freeswitch/xml">
<section name="configuration">
<configuration name="sofia.conf" description="sofia Endpoint">
  <global_settings>
    <param name="log-level" value="0"/>
    <param name="debug-presence" value="0"/>
    <param name="bind-params" value="transport=udp"/>
  </global_settings>
  <profiles>
     <profile name="external">
        <gateways>

        </gateways>
        <aliases/>
          <domains>
                <domain name="all" alias="false" parse="true"/>
          </domains>
        <settings>


        </settings>

    </profile>
    <profile name="internal">
        <settings>

        </settings>
    </profile>
  </profiles>
</configuration>
<configuration name="ivr.conf" description="IVR menus">
  <menus>
    <menu name="ivr-test" greet-long="say:welcome to neron.  press 1 for sales .   press 2 for support.  press 3 for accounts.  press 4 for me " greet-short="" invalid-sound="say:it was an invalid sound" exit-sound="say:thankyou for contacting us" confirm-macro="" confirm-key="" tts-engine="flite" tts-voice="slt" confirm-attempts="" timeout="10000" inter-digits-timeout="2000" max-failures="3" max-timeouts="" digit-len="4">
      <entry action="menu-exec-app" digits="1" param="bridge sofia/internal/2001@192.168.1.105"/>
      <entry action="menu-exec-app" digits="2" param="bridge sofia/internal/2002@192.168.1.105"/>
      <entry action="menu-exec-app" digits="3" param="bridge sofia/internal/2003@192.168.1.105"/>
    </menu>
  </menus>
</configuration>

And it gives me 它给了我

This page contains the following errors: error on line 1 at column 7: XML declaration allowed only at the start of the document Below is a rendering of the page up to the first error. 该页面包含以下错误:第1列第7列的错误:仅在文档开始处允许XML声明以下是该页面的呈现,直至出现第一个错误。

When i remove <?xml version="2.5" encoding="UTF-8" standalone="no"?> then it works fine. 当我删除<?xml version="2.5" encoding="UTF-8" standalone="no"?>它工作正常。 This project is totally annotation based not here web.xml file . 该项目完全基于注释,而不是web.xml文件。 Can You solve it? 你能解决吗? Thanks 谢谢

I often avoid empty lines at the top of text, doing: 我经常避免在文本顶部使用空行,方法是:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"
%><%@ page contentType="text/xml" %><%@ page isELIgnored="false"
%><?xml version="2.5" encoding="UTF-8" standalone="no"?>

Whether this would help here is the question. 问题是否在这里会有所帮助。 Though you can do: 尽管可以:

<c:out value='&lt;?xml version="2.5" encoding="UTF-8" standalone="no"?&gt;'
 escapeXml="false"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM