【问题标题】:icefaces mobile TabSetMetaHandler(in icefaces-mobi) class not able to access class MethodRule(in icefaces)icefaces 移动 TabSetMetaHandler(在 icefaces-mobi 中)类无法访问类 MethodRule(在 icefaces 中)
【发布时间】:2013-05-08 06:36:35
【问题描述】:

我正在使用 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)

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

【问题讨论】:

    标签: java tomcat mobile icefaces


    【解决方案1】:

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

    【讨论】:

    • 感谢您的回复。上面的 xhtml(mDashboard.xhtml) 不包含在任何其他页面中。我也通过删除 html、head、body 标签来尝试相同的方法。但问题仍然相同。 :( 这是一个简单的视图名称,由支持 bean 的方法返回(即成功认证后的登录方法)。点击登录:- 我正在调用 bean 的方法进行身份验证,它只是返回 mDashboard。
    • 能否列出您项目中包含的其他 jars 及其版本?可能是jar不兼容。 ICEmobile 附带特定版本的 ICEfaces,并且可能与早期版本存在问题。 ICEmobile 1.2 附带 ICEfaces 3.2.0。
    【解决方案2】:

    我正在使用以下罐子:-

    <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)然后在安卓手机请求时渲染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)然后进入backing bean的登录方法成功认证:- 类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>
    

    但它会抛出错误跟踪。

    【讨论】:

      【解决方案3】:

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

      【讨论】:

      • 正如我所说,我从 mLoginPage.xhtml 中删除了 html 标记并使用了 ui:composition 标记,但据我了解,我正在渲染新视图(mDashboard.xhtml),因为它与以前的视图无关浏览器。当我在 mDashboard 中使用 ui 组合标记时,它会引发错误 - javax.servlet.ServletException: failed to append element[tag: div;属性:] 到 #document javax.faces.webapp.FacesServlet.service(FacesServlet.java:606) 根本原因 java.lang.RuntimeException: 未能附加元素 [标签:div;属性:] 到 #document 但是如果我删除了 ui:composition 它会呈现意外的视图
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多