Primefaces:XML5635:只允许在文件的开头使用XML声明

时间:2014-06-17 05:55:35

标签: java xml internet-explorer jsf primefaces

迁移到PF 5.0后,在单击p:commandlink或p:commandButton后,IE浏览器上的导航功能无效,而且未加载新页面,而不是控制台上有消息: XML5635:只允许在文件开头使用XML声明。行:1,第18列

这仅适用于Firefox Chrome上的IE,它可以正常工作。

第一个文件:

<!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:p="http://primefaces.org/ui"
          xmlns:ui="http://java.sun.com/jsf/facelets">

        <h:head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
            <title>.... </title>

            <meta name="Description" content="......"/>
            <meta name="AUTHOR" content="..."/>

            <meta name="KEYWORDS" content="....."/>

    <h:outputText 
        value="&lt;!--[if !IE]&gt; --&gt; &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;#{sessionBean.getUrlPrefix()}html/style.css&quot; /&gt; &lt;!-- &lt;![endif]--&gt;"
        escape="false" />


    <h:outputText 
        value="&lt;!--[if IE ]&gt;&lt;link rel=&quot;stylesheet&quot; href=&quot;#{sessionBean.getUrlPrefix()}html/style-ie.css&quot; /&gt; &lt;![endif]--&gt;"
        escape="false" />

        </h:head>

        <h:body>

            <div id="top">
                <ui:insert name="header">
                    <ui:include src="header.xhtml"/>
                </ui:insert>
                <div id="CONTENT"><div id="TRESC">
                        <ui:insert name="leftBar">
                            <ui:include src="leftbar.xhtml"/>
                        </ui:insert>
                        <div style="width: 700px; float: left;">
                            <f:metadata>
                                <f:viewParam name="CalendarSet" value="#{sessionBean.calendarSet}" />
                            </f:metadata>
                            <h1 style=" text-align: center; font-size: 30px;">#{tr['chooseCalendarType']}</h1>

                            <p:accordionPanel   multiple="true">
                                <p:tab title="#{calendarTypesHandlingBean.typeT1Name}" rendered="#{calendarTypesHandlingBean.isActiveT1()}">
                                    <h:form>
                                        <p:dataGrid value="#{calendarTypesHandlingBean.calendariumT1}" var="calendarium" columns="2"   >

                                            <p:panel >

                                                <h:panelGrid columns="1" style="text-align:center;"  >
                                                    <p:commandLink action="#{calendarTypesHandlingBean.calendariumChosen(calendarium.id)}">
                                                        <p:graphicImage width="250" id="image_num"  value="#{calendarium.imageUrl}" />
                                                    </p:commandLink>
                                                    <p:tooltip  style="background: grey; color:white;" for="image_num"  showEffect="fade" hideEffect="fade">
                                                        <h:outputText escape="false" value="#{calendarium.name}"/>
                                                    </p:tooltip>

                                                    <p:commandButton action="#{calendarTypesHandlingBean.calendariumChosen(calendarium.id)}" value="#{tr['choose']}"/>
                                                </h:panelGrid> 

                                            </p:panel>

                                        </p:dataGrid>
                                    </h:form>
                                </p:tab>
                                <p:tab title="#{calendarTypesHandlingBean.typeT2Name}" rendered="#{calendarTypesHandlingBean.isActiveT2()}">
                                    <h:form>
                                        <p:dataGrid  style="border: none;" value="#{calendarTypesHandlingBean.calendariumT2}" var="calendarium" columns="2"   >

                                            <p:panel style="width: 320px; text-align:center;" >

                                                <h:panelGrid columns="1" styleClass="backgroudless" style="text-align:center;"  >
                                                    <p:commandLink action="#{calendarTypesHandlingBean.calendariumChosen(calendarium.id)}">
                                                        <p:graphicImage width="250" id="image_num"  value="#{calendarium.imageUrl}" />
                                                    </p:commandLink>

                                                    <p:commandButton action="#{calendarTypesHandlingBean.calendariumChosen(calendarium.id)}" value="#{tr['choose']}"/>

                                                </h:panelGrid> 

                                            </p:panel>

                                        </p:dataGrid>
                                    </h:form>
                                </p:tab>   
                                <p:tab title="#{calendarTypesHandlingBean.typeT3Name}" rendered="#{calendarTypesHandlingBean.isActiveT3()}">
                                    <h:form>
                                        <p:dataGrid styleClass="backgroudless" style="border: none;" value="#{calendarTypesHandlingBean.calendariumT3}" var="calendarium" columns="2"   >

                                            <p:panel styleClass="backgroudless" style="width: 320px; text-align:center;" >

                                                <h:panelGrid columns="1" styleClass="backgroudless" style="text-align:center;"  >
                                                    <p:commandLink action="#{calendarTypesHandlingBean.calendariumChosen(calendarium.id)}">
                                                        <p:graphicImage width="250" id="image_num"  value="#{calendarium.imageUrl}" />
                                                    </p:commandLink>

                                                    <p:commandButton action="#{calendarTypesHandlingBean.calendariumChosen(calendarium.id)}" value="#{tr['choose']}"/> 

                                                </h:panelGrid> 

                                            </p:panel>

                                        </p:dataGrid>
                                    </h:form>
                                </p:tab>    
                                <p:tab title="#{calendarTypesHandlingBean.typeT4Name}" rendered="#{calendarTypesHandlingBean.isActiveT4()}">
                                    <h:form>
                                        <p:dataGrid styleClass="backgroudless" style="border: none;" value="#{calendarTypesHandlingBean.calendariumT4}" var="calendarium" columns="2"   >

                                            <p:panel styleClass="backgroudless" style="width: 320px; text-align:center;" >

                                                <h:panelGrid columns="1" styleClass="backgroudless" style="text-align:center;"  >
                                                    <p:commandLink action="#{calendarTypesHandlingBean.calendariumChosen(calendarium.id)}">
                                                        <p:graphicImage width="250" id="image_num"  value="#{calendarium.imageUrl}" />
                                                    </p:commandLink>

                                                    <p:commandButton action="#{calendarTypesHandlingBean.calendariumChosen(calendarium.id)}" value="#{tr['choose']}"/>
                                                </h:panelGrid> 

                                            </p:panel>

                                        </p:dataGrid>
                                    </h:form>
                                </p:tab>                             
                                 <p:tab title="#{calendarTypesHandlingBean.typeT5Name}" rendered="#{calendarTypesHandlingBean.isActiveT5()}">
                                    <h:form>
                                        <p:dataGrid styleClass="backgroudless" style="border: none;" value="#{calendarTypesHandlingBean.calendariumT5}" var="calendarium" columns="2"   >

                                            <p:panel styleClass="backgroudless" style="width: 320px; text-align:center;" >

                                                <h:panelGrid columns="1" styleClass="backgroudless" style="text-align:center;"  >
                                                    <p:commandLink action="#{calendarTypesHandlingBean.calendariumChosen(calendarium.id)}">
                                                        <p:graphicImage width="250" id="image_num"  value="#{calendarium.imageUrl}" />
                                                    </p:commandLink>

                                                    <p:commandButton action="#{calendarTypesHandlingBean.calendariumChosen(calendarium.id)}" value="#{tr['choose']}"/>
                                                </h:panelGrid> 

                                            </p:panel>

                                        </p:dataGrid>
                                    </h:form>
                                </p:tab>       

                            </p:accordionPanel>  
                        </div>
                    </div>
                    <ui:insert name="footer">
                        <ui:include src="footer.xhtml"/>
                    </ui:insert>
                </div></div>

        </h:body>
    </html>

和第二个:

<!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:p="http://primefaces.org/ui"
          xmlns:ui="http://java.sun.com/jsf/facelets">

        <h:head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
            <title>...</title>

            <meta name="Description" content="..."/>
            <meta name="AUTHOR" content="..."/>

            <meta name="KEYWORDS" content="..."/>
    <h:outputText 
        value="&lt;!--[if !IE]&gt; --&gt; &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;#{sessionBean.getUrlPrefix()}html/style.css&quot; /&gt; &lt;!-- &lt;![endif]--&gt;"
        escape="false" />


    <h:outputText 
        value="&lt;!--[if IE ]&gt;&lt;link rel=&quot;stylesheet&quot; href=&quot;#{sessionBean.getUrlPrefix()}html/style-ie.css&quot; /&gt; &lt;![endif]--&gt;"
        escape="false" />


        </h:head>

        <h:body>
            <div id="top">
                <ui:insert name="header">
                    <ui:include src="header.xhtml"/>
                </ui:insert>
                <div id="CONTENT"><div id="TRESC">
                        <ui:insert name="leftBar">
                            <ui:include src="leftbar.xhtml"/>
                        </ui:insert>

            <div style="float: left;width: 730px;">
                  <h1 style=" text-align: center; font-size: 30px;">#{tr['chooseCalendarBackground']}</h1>
                  <h:form>
                <p:dataGrid columns="3"  style=" border-style: none;" value="#{backgroundSelectorBean.backgrounds}" var="item" >

            <p:panel style="text-align:center; width: 220px; "  >
                <h:panelGrid columns="1" style="width:100%; border: 0; text-align: center;"  >
                    <p:commandLink action="#{backgroundSelectorBean.selectedBackground(item.backgroundId, item.backgroundPatch)}">
                    <p:graphicImage width="200" id="image_num" value="#{item.backgroundThumbURL}" />
                    </p:commandLink>
                    <p:commandButton action="#{backgroundSelectorBean.selectedBackground(item.backgroundId, item.backgroundPatch)}" value="#{tr['choose']}" />  

                </h:panelGrid> 
            </p:panel>

        </p:dataGrid>
                      </h:form>
                     <p:button outcome="back" value="#{tr['back']}">  
                    </p:button>
                </div>

                    </div>
                                    <ui:insert name="footer">
                        <ui:include src="footer.xhtml"/>
                    </ui:insert>
                </div></div>
            </h:body>
    </html>

我很感激你的帮助。

0 个答案:

没有答案