简体   繁体   English

Javax Faces的搜索解决方案

[英]Search Solution for javax faces

every time if an error occurs, I get the following error message in the error page. 每次发生错误时,我都会在错误页面上收到以下错误消息。

This is my page.xhtml : 这是我的page.xhtml:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<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:p="http://primefaces.org/ui">

    <f:view contentType="text/html">
        <h:head>
            <f:facet name="first">
                <meta http-equiv="X-UA-Compatible" content="EmulateIE8" />
                <meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
                <title>Esprit4Olap</title>
            </f:facet>

            <link type="text/css" rel="stylesheet" href="#{request.contextPath}/css/default.css" />
            <link type="text/css" rel="stylesheet" href="#{request.contextPath}/css/syntaxhighlighter/syntaxhighlighter.css" />

            <style type="text/css">
                .nestedUnit {
                    border:0px none !important;
                }

                .ui-layout-center .ui-layout-resizer {
                    border:1px solid #A8A8A8 !important;
                }

                .ui-tree-item span {
                    float:left !important;
                }

                .ui-tree {
                    border:0px none !important;
                }

                .ui-tabs {
                    border:0px none !important;
                }
            </style>
        </h:head>

        <h:body>

                <p:layoutUnit position="west" size="200" resizable="true" collapsible="true" header="TreeNode">
                    <h:form>
                        <p:tree value="#{SchemaMan.shemaBoxses}" var="SchemaMan" selectionMode="Singel" selection="#{SchemaMan.shemaBoxse}" style="width:170px">
                            <p:treeNode icon="ui-icon-mail-closed">
                                <h:outputText value="SchemaMan"/>
                            </p:treeNode>

                            <p:treeNode type="i" icon="ui-icon-mail-closed">
                                <h:outputText value="SchemaMan"/>
                            </p:treeNode>

                            <p:treeNode type="s" icon="ui-icon-transfer-e-w">
                                <h:outputText value="SchemaMan"/>
                            </p:treeNode>

                            <p:treeNode type="t" icon="ui-icon-trash">
                                <h:outputText value="SchemaMan"/>
                            </p:treeNode>

                            <p:treeNode type="j" icon="ui-icon-alert">
                               <h:outputText value="SchemaMan"/>
                            </p:treeNode>
                        </p:tree>
                    </h:form>
                </p:layoutUnit>

                <p:layoutUnit position="center">

                    <p:layout>

                        <p:layoutUnit position="north" size="50%" resizable="true" styleClass="nestedUnit">

                            <p:tabView>

                                <p:tab title="Schema">

                                    <h:form>

                                        <p:panelGrid columns="2">

                                        <p:inputText id="Schemaname" required="true"    label="SchemaName" size="40" value="#{SchemaMan.nameSchema}" />

                                        <p:inputText id="DescSchema" required="true"    label="DescSchema" size="40" value="#{SchemaMan.descSchema}" />

                                       <p:inputText id="RoleSchema" required="true"     label="RoleSchema" size="40" value="#{SchemaMan.roleSchema}" />

                                       <p:inputText id="CaptionSchema" required="true"  label="CaptionSchema" size="40" value="#{SchemaMan.captionSchema}" />      
                                        </p:panelGrid>
                                          <p:commandButton value="Add" type="button" ></p:commandButton>

                                    </h:form>

                                </p:tab>

                            </p:tabView>

                        </p:layoutUnit> 
                    </p:layout>

                </p:layoutUnit>
            </h:body>
</f:view>
</html>

The error itself, however, is not related to javax.faces.component.UIOutput. 但是,错误本身与javax.faces.component.UIOutput不相关。 It can be just any error in one of the managed beans. 在一个受管Bean中可能只是任何错误。 and i got this erros exception: 我得到了这个错误的例外:

javax.servlet.ServletException: javax.faces.component.UIOutput cannot be cast to org.primefaces.component.layout.Layout
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)

Any help is appreciated. 任何帮助表示赞赏。

Thanks, 谢谢,

i make it like you told me : 我做到了,就像你告诉我的那样:

 <h:body>


<p:layout>
                <p:layoutUnit position="west" size="200" resizable="true" collapsible="true" header="TreeNode">
                    <h:form>
                        <p:tree value="#{SchemaMan.shemaBoxses}" var="SchemaMan" selectionMode="Singel" selection="#{SchemaMan.shemaBoxse}" style="width:170px">
                            <p:treeNode icon="ui-icon-mail-closed">
                                <h:outputText value="SchemaMan"/>
                            </p:treeNode>

                            <p:treeNode type="i" icon="ui-icon-mail-closed">
                                <h:outputText value="SchemaMan"/>
                            </p:treeNode>

                            <p:treeNode type="s" icon="ui-icon-transfer-e-w">
                                <h:outputText value="SchemaMan"/>
                            </p:treeNode>

                            <p:treeNode type="t" icon="ui-icon-trash">
                                <h:outputText value="SchemaMan"/>
                            </p:treeNode>

                            <p:treeNode type="j" icon="ui-icon-alert">
                               <h:outputText value="SchemaMan"/>
                            </p:treeNode>
                        </p:tree>
                    </h:form>
                </p:layoutUnit>
                </p:layout>
 <p:layout>
                <p:layoutUnit position="center">



                        <p:layoutUnit position="north" size="50%" resizable="true" styleClass="nestedUnit">

                            <p:tabView>

                                <p:tab title="Schema">

                                    <h:form>

                                        <p:panelGrid columns="2">

                                        <p:inputText id="Schemaname" required="true"    label="SchemaName" size="40" value="#{SchemaMan.nameSchema}" />

                                        <p:inputText id="DescSchema" required="true"    label="DescSchema" size="40" value="#{SchemaMan.descSchema}" />

                                       <p:inputText id="RoleSchema" required="true"     label="RoleSchema" size="40" value="#{SchemaMan.roleSchema}" />

                                       <p:inputText id="CaptionSchema" required="true"  label="CaptionSchema" size="40" value="#{SchemaMan.captionSchema}" />





                                        </p:panelGrid>
                                          <p:commandButton value="Add" type="button" ></p:commandButton>

                                    </h:form>

                                </p:tab>

                            </p:tabView>

                        </p:layoutUnit>





                </p:layoutUnit>
    </p:layout>

            </h:body>

but i get this exception now : exception 但是我现在得到这个异常:异常

javax.servlet.ServletException: JBAS011048: Failed to construct component instance javax.faces.webapp.FacesServlet.service(FacesServlet.java:606) !! javax.servlet.ServletException:JBAS011048:无法构造组件实例javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)!

You have two p:layout ? 您有两个p:layout吗? Every p:layoutUnit should be inside a whole p:layout . 每个p:layoutUnit应该在整个p:layout内部。 Take into account that you can nest a p:layout inside a p:layoutUnit to make more complex layouts (and of course, every p:layout HAS to have a p:layoutUnit position="center" : 考虑到你可以嵌套一个p:layout一内部p:layoutUnit做出更复杂的布局(当然,每一个p:layout 必须有一个p:layoutUnit position="center"

<p:layout>
   <p:layoutUnit position="west" size="200">
     ...
   </p:layoutUnit>
   <p:layoutUnit position="center">
     <p:layout>
       <p:layoutUnit position="north" size="100">
         ...
       </p:layoutUnit>
       <p:layoutUnit position="center">
         ...
       </p:layoutUnit>
     </p:layout>
   </p:layoutUnit>
  ...
</p:layout>

Remember that if you use ap:layout for your whole page, you might be better off with p:layout fullPage="true" . 请记住,如果您对整个页面使用ap:layout,则最好使用p:layout fullPage="true" Cheers! 干杯!

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

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