0

我正在使用 icefaces-mobi 框架开发一个移动网站。我们已经在 icefaces 框架中开发了一个网站,现在我们想动员我们的网站。成功验证后,我将测试视图名称作为字符串(mDashboard)返回,得到解析并尝试呈现 mDashboard.xhtml,这是我的代码

    <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:ui="http://java.sun.com/jsf/facelets"
             xmlns:mobi="http://www.icesoft.com/icefaces/mobile/component">
<h:head>
    <mobi:deviceResource />
</h:head>
<h:body>
<ui:composition>
        <mobi:tabSet currentId="1">

            <mobi:contentPane title="Ice Sailer" id="tab1"
                              facelet="false" client="true" >
                <h:outputText value="A" />
            </mobi:contentPane>

            <mobi:contentPane title="Ice Breaker" id="tab2"
                          facelet="false" client="true" >

                 <h:outputText value="B" />

            </mobi:contentPane>

            <mobi:contentPane title="Ice Skater" id="tab3"
                              facelet="false" client="true" >
                 <h:outputText value="C" />
            </mobi:contentPane>

        </mobi:tabSet>

</ui:composition>
</h:body>
</html>

但是服务器返回带有错误描述的 http 状态 500

根本原因

java.lang.IllegalAccessError: org/icefaces/facelets/tag/icefaces/core/MethodRule org.icefaces.mobi.component.tabset.TabSetMetaHandler.createMetaRuleset(TabSetMetaHandler.java:22) javax.faces.view.facelets.MetaTagHandler.setAttributes (MetaTagHandler.java:127) javax.faces.view.facelets.DelegatingMetaTagHandler.setAttributes(DelegatingMetaTagHandler.java:102) com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.doNewComponentActions(ComponentTagHandlerDelegateImpl.java:409) com.sun .faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:159) javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) com.sun.faces.facelets.tag.ui.CompositionHandler .apply(CompositionHandler.java:166) com.sun.faces.facelets.compiler.NamespaceHandler。apply(NamespaceHandler.java:93) com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86) com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:152) com. sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:774) com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100) com.sun.faces.lifecycle.Phase.doPhase(Phase. java:101) com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)buildView(FaceletViewHandlingStrategy.java:774) com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) com.sun.faces。生命周期.LifecycleImpl.render(LifecycleImpl.java:139) javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)buildView(FaceletViewHandlingStrategy.java:774) com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) com.sun.faces。生命周期.LifecycleImpl.render(LifecycleImpl.java:139) javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)

请帮帮我。任何帮助将不胜感激。提前谢谢。

4

3 回答 3

0

我正在使用以下罐子:-

<dependency>
    <groupId>org.icefaces</groupId>
    <artifactId>icefaces-compat</artifactId>
    <version>3.2.0</version>
</dependency>
<dependency>
    <groupId>org.icefaces</groupId>
    <artifactId>icefaces-mobi</artifactId>
    <version>1.2.0</version>
</dependency>
<dependency>
    <groupId>org.icefaces</groupId>
    <artifactId>icefaces-ace</artifactId>
    <version>3.2.0</version>
</dependency>
<dependency>
    <groupId>org.icefaces</groupId>
    <artifactId>icefaces</artifactId>
    <version>3.2.0</version>
</dependency>

但现在我面临新的错误: -

exception

javax.servlet.ServletException: failed to append element[tag: div; attributes: ] into #document
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)

root cause

java.lang.RuntimeException: failed to append element[tag: div; attributes: ] into #document
    org.icefaces.impl.context.DOMResponseWriter.appendToCursor(DOMResponseWriter.java:431)
    org.icefaces.impl.context.DOMResponseWriter.startElement(DOMResponseWriter.java:263)
    org.icefaces.mobi.component.tabset.TabSetRenderer.encodeBegin(TabSetRenderer.java:83)
    javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:820)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:1755)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
    com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402)
    com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)

root cause

org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. 
    com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.insertBefore(CoreDocumentImpl.java:391)
    com.sun.org.apache.xerces.internal.dom.NodeImpl.appendChild(NodeImpl.java:235)
    org.icefaces.impl.context.DOMResponseWriter.appendToCursor(DOMResponseWriter.java:426)
    org.icefaces.impl.context.DOMResponseWriter.startElement(DOMResponseWriter.java:263)
    org.icefaces.mobi.component.tabset.TabSetRenderer.encodeBegin(TabSetRenderer.java:83)
    javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:820)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:1755)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
    com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402)
    com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
    com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)

我的申请流程如下:-

1)这是索引页-

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html >
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:mobi="http://www.icesoft.com/icefaces/mobile/component">
<h:head>
    <title>title</title>
    <mobi:deviceResource />
</h:head>
<h:body>

    <mobi:smallView>
        <ui:param name="viewSize" value="small" />
        <ui:include src="fragments/mLoginPage.xhtml" />
    </mobi:smallView>
    <mobi:largeView>
        <ui:param name="viewSize" value="large" />
        <ui:include src="homepage.xhtml" />
    </mobi:largeView>

</h:body>
</html>

2)然后当来自android手机的请求时,它会呈现mLoginPage.xhtml:-

<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:ui="http://java.sun.com/jsf/facelets" 
    xmlns:mobi="http://www.icesoft.com/icefaces/mobile/component" > 

    <div id="login" class="container">

        <div class="subHeader">
            <f:facet name="header">
                <h:panelGroup>Credentials</h:panelGroup>
            </f:facet>
        </div>

        <div class="subContent">
            <h:form id="loginForm" binding="#{loginUIBean.loginComponent}">
            <h:message for="loginForm" layout="table" class="error"/>
            <div style="text-align: center;">
                <mobi:fieldsetGroup>
                    <mobi:fieldsetRow>
                        <h:graphicImage value="images/MP-logo.png" style="float:center;"/>                  
                    </mobi:fieldsetRow>
                    <mobi:fieldsetRow>
                        <h:outputLabel for="email" value="Login Id:"/>
                        <mobi:inputText id="email" autocorrect="on" singleSubmit="false" type="text" placeholder="Email Id"
                            value="#{loginUIBean.loginEmailId}"/>
                    </mobi:fieldsetRow>

                    <mobi:fieldsetRow>
                        <h:outputLabel for="password" value="Password:"/>
                        <mobi:inputText id="password" type="password" singleSubmit="false" placeholder="Password"
                            value="#{loginUIBean.password}">
                        </mobi:inputText>
                    </mobi:fieldsetRow>
                    <mobi:fieldsetRow>
                        <h:selectBooleanCheckbox value="#" immediate="true" id="saveCredentials" />
                        <h:outputLabel value="Save my credentials on this mobile phone."></h:outputLabel>
                    </mobi:fieldsetRow>
                    <mobi:fieldsetRow>
                        <mobi:commandButton value="Login" styleClass="submit" action="#{loginUIBean.login}"/>
                    </mobi:fieldsetRow>            
                </mobi:fieldsetGroup>
            </div>  
            </h:form>
        </div>
    </div>

</html>

3)然后转到支持bean的登录方法成功进行身份验证:- class LoginUiBean

public String login(){
   //logic to auth.
   //----
    return "mDashboard";

}

4)然后我希望在屏幕上看到示例 mDashboard(或任何包含 ice-mobi 组件页面的页面):-

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:mobi="http://www.icesoft.com/icefaces/mobile/component">

    <mobi:tabSet currentId="1">

            <mobi:contentPane title="Ice Sailer" id="tab1"
                              facelet="false" client="true" >
                <h:outputText value="A" />
            </mobi:contentPane>

            <mobi:contentPane title="Ice Breaker" id="tab2"
                          facelet="false" client="true" >

                 <h:outputText value="B" />

            </mobi:contentPane>

            <mobi:contentPane title="Ice Skater" id="tab3"
                              facelet="false" client="true" >
                 <h:outputText value="C" />
            </mobi:contentPane>

        </mobi:tabSet>

</ui:composition>

但它会抛出错误跟踪。

于 2013-05-09T14:58:13.777 回答
0

由于 mLoginPage.xhtml 是一个片段,您应该使用 ui:composition 标签而不是标签,或者直接在 .

于 2013-05-09T18:18:56.797 回答
0

上面的 xhtml 是包含在另一个页面中的片段吗?如果没有,那么您应该删除它,因为这将切断它之外的所有组件。

于 2013-05-08T20:51:02.933 回答