简体   繁体   中英

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 :

<!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. It can be just any error in one of the managed beans. 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) !!

You have two p:layout ? Every p:layoutUnit should be inside a whole 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 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" . Cheers!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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