PrimeFaces向导无法在页面中嵌入

时间:2014-07-16 03:27:19

标签: java netbeans primefaces

我在NetBeans中从零开始创建了一个PrimeFaces向导,它主要工作(在提交后仍然无法获取确认.xhtml页面...)。然后我将表单的代码移动到预先构建的html页面,现在向导无法正常工作。它显示第一个选项卡,然后显示" next"按钮无效。

任何人都可以看到表单(大部分)在隔离中起作用的原因,但是当放入另一个html页面(.xhtml)时却没有。

原始巫师:(如果你能弄清楚它是什么,它还没有提交,请告诉我。)

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Input page</title>
    </h:head>
    <h:body>
        <h:form>   
            <p:wizard id="wizard">
                <p:tab title="Booking" id="booking">
                    <p:panel header="Booking">
                        <p:messages/>
                        <h:panelGrid columns="2">

                            <h:outputLabel for="firstName" 
                                           value="First Name" 
                                           styleClass="requiredLbl"/>
                            <h:inputText id="firstName" 
                                         label="First Name" 
                                         value="#{userBean.firstName}" 
                                         required="true"/>
                            <h:outputLabel for="lastName" 
                                           value="Last Name" 
                                           styleClass="requiredLbl"/>
                            <h:inputText id="lastName" label="Last Name" 
                                         value="#{userBean.lastName}" 
                                         required="true"/>
                            <h:outputLabel for="email" 
                                           value="Email" 
                                           styleClass="requiredLbl"/>
                            <h:inputText id="email" label="Email" 
                                         value="#{userBean.email}" 
                                         required="true"/>


                            <p:outputLabel for="console" value="Time of Day:" />
                            <p:selectOneRadio id="console" value="#{userBean.timeOfDay}">
                                <f:selectItem itemLabel="Morning" itemValue="Morning" />
                                <f:selectItem itemLabel="Afternoon" itemValue="Afternoon" />
                                <f:selectItem itemLabel="Evening" itemValue="Evening" />
                            </p:selectOneRadio>


                            <h:outputLabel for="checkout_date"
                                           value="Checkout Date"
                                           styleClass="requiredLbl"/>

                            <p:calendar id="checkout_date"
                                        label="Checkout Date"
                                        value="#{userBean.checkout_date}"/>

                            <h:outputLabel for="checkin_date"
                                           value="Checkin Date"
                                           styleClass="requiredLbl"/>

                            <p:calendar id="checkin_date"
                                        label="Checkin Date"
                                        value="#{userBean.checkin_date}"/>
                            <p:outputLabel for="type" value="Type:" />
                            <p:selectOneRadio id="type" value="#{userBean.type}">
                                <f:selectItem itemLabel="Cheap" itemValue="Cheap" />
                                <f:selectItem itemLabel="Standard" itemValue="Standard" />
                                <f:selectItem itemLabel="Lux" itemValue="Lux" />
                            </p:selectOneRadio>
                            <h:outputLabel for="adults" value="Adults:" />
                            <p:spinner id="adults" value="#{userBean.numAdults}" />
                            <h:outputLabel for="children" value="Children:" />
                            <p:spinner id="children" value="#{userBean.numChildren}" />

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

                <p:tab title="Payment" id="payment">
                    <p:panel header="Booking">
                        <p:messages/>
                        <h:panelGrid columns="2">
                            <h:outputLabel for="creditCard" 
                                           value="Credit Card Number:" 
                                           styleClass="requiredLbl"/>
                            <h:inputText id="creditCard" 
                                         label="Credit Card" 
                                         value="#{userBean.creditCard}" 
                                         required="true"/>
                            <h:outputLabel for="address1" 
                                           value="Address:" 
                                           styleClass="requiredLbl"/>
                            <h:inputText id="address1" 
                                         label="address" 
                                         value="#{userBean.address1}" 
                                         required="true"/>
                            <h:outputLabel for="address2" 
                                           value="Address 2:" 
                                           styleClass="requiredLbl"/>
                            <h:inputText id="address2" 
                                         label="address 2" 
                                         value="#{userBean.address2}" 
                                         required="true"/>
                            <h:outputLabel for="city" 
                                           value="City:" 
                                           styleClass="requiredLbl"/>
                            <h:inputText id="city" 
                                         label="city" 
                                         value="#{userBean.city}" 
                                         required="true"/>
                            <h:outputLabel for="state" 
                                           value="State:" 
                                           styleClass="requiredLbl"/>
                            <h:inputText id="state" 
                                         label="state" 
                                         value="#{userBean.state}" 
                                         required="true"/>
                            <h:outputLabel for="zip" 
                                           value="Zip:" 
                                           styleClass="requiredLbl"/>
                            <h:inputText id="zip" 
                                         label="zip" 
                                         value="#{userBean.zip}" 
                                         required="true"/>
                        </h:panelGrid>
                    </p:panel>
                </p:tab>
                <p:tab title="Submit" id="submit">
                    <p:panel header="Booking">
                        <p:messages/>
                        <h:panelGrid columns="2">
                            <h:outputLabel for="message" 
                                           value="Message:" 
                                           styleClass="requiredLbl"/>
                            <p:inputTextarea rows="10" cols="30" completeMethod="#{userBean.message}" />

                            <h:outputLabel for="agree_terms" 
                                           value="I have read and agree to terms: " 
                                           styleClass="requiredLbl"/>
                            <p:selectBooleanCheckbox value="#{userBean.agree_terms}" />

                             <h:outputLabel for="total" 
                                           value="Total:" 
                                           styleClass="requiredLbl"/>
                            <h:inputText id="total" 
                                         label="total" 
                                         value="#{userBean.total}"
                                         disabled="true"
                                         required="true"/>

                            <p:commandButton id="submitButton"
                                                 value="Submit" 
                                                 action="#{userBean.saveUser()}"
                                                 process="@this"                                                 
                                                  />




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

                </p:tab>


            </p:wizard>
        </h:form>
    </h:body>
</html>

新的index.xhtml文件(粘贴的表单位于内容标记下方):

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Input page</title>
        <meta charset="utf-8"/>
        <meta name = "format-detection" content = "telephone=no" />
        <link rel="icon" href="images/favicon.ico"/>
        <link rel="shortcut icon" href="images/favicon.ico" />
        <link rel="stylesheet" href="booking/css/booking.css"/>
        <link rel="stylesheet" href="css/camera.css"/>
        <link rel="stylesheet" href="css/owl.carousel.css"/>
        <link rel="stylesheet" href="css/style.css"/>
        <script src="js/jquery.js"></script>
        <script src="js/jquery-migrate-1.2.1.js"></script>
        <script src="js/script.js"></script>
        <script src="js/superfish.js"></script>
        <script src="js/jquery.ui.totop.js"></script>
        <script src="js/jquery.equalheights.js"></script>
        <script src="js/jquery.mobilemenu.js"></script>
        <script src="js/jquery.easing.1.3.js"></script>
        <script src="js/owl.carousel.js"></script>
        <script src="js/camera.js"></script>

        <script src="js/jquery.mobile.customized.min.js"></script>

        <script src="booking/js/booking.js"></script>
    </h:head>
    <h:body>
        <header>
            <div class="menu_block ">
                <div class="container_12">
                    <div class="grid_12">
                        <nav class="horizontal-nav full-width horizontalNav-notprocessed">
                            <ul class="sf-menu">
                                <li class="current"><a href="index.xhtml">Home</a></li>
                                <li><a href="index-1.html">About</a></li>
                                <li><a href="index-2.html">Cars</a></li>
                                <li><a href="index-3.html">Services</a></li>
                                <li><a href="index-4.html">Contacts</a></li>
                            </ul>
                        </nav>
                        <div class="clear"></div>
                    </div>
                    <div class="clear"></div>
                </div>
            </div>
            <div class="container_12">
                <div class="grid_12">
                    <h1>
                        <a href="index.xhtml">
                            <img src="images/logo.png" alt="Your Happy Family" />
                        </a>
                    </h1>
                </div>
            </div>
            <div class="clear"></div>
        </header>
        <div class="slider_wrapper ">
            <div id="camera_wrap" class="">
                <div data-src="images/slide.jpg" ></div>
                <div data-src="images/slide1.jpg" ></div>
                <div data-src="images/slide2.jpg"></div>
            </div>
        </div>
        <div class="container_12">
            <div class="grid_4">
                <div class="banner">
                    <div class="maxheight">
                        <div class="banner_title">
                            <img src="images/icon1.png" alt="" />
                            <div class="extra_wrapper">Fast&amp;
                                <div class="color1">Safe</div>
                            </div>
                        </div>
                        Dorem ipsum dolor sit amet, consectetur adipiscinger elit. In mollis erat mattis neque facilisis, sit ameter ultricies erat rutrum. Cras facilisis, nulla vel viver auctor, leo magna sodales felis, quis malesuad
                        <a href="#" class="fa fa-share-square"></a>
                    </div>
                </div>
            </div>
            <div class="grid_4">
                <div class="banner">
                    <div class="maxheight">
                        <div class="banner_title">
                            <img src="images/icon2.png" alt="" />
                            <div class="extra_wrapper">Best
                                <div class="color1">Prices</div>
                            </div>
                        </div>
                        Hem ipsum dolor sit amet, consectetur adipiscinger elit. In mollis erat mattis neque facilisis, sit ameter ultricies erat rutrum. Cras facilisis, nulla vel viver auctor, leo magna sodales felis, quis malesuader
                        <a href="#" class="fa fa-share-square"></a>
                    </div>
                </div>
            </div>
            <div class="grid_4">
                <div class="banner">
                    <div class="maxheight">
                        <div class="banner_title">
                            <img src="images/icon3.png" alt="" />
                            <div class="extra_wrapper">Package
                                <div class="color1">Delivery</div>
                            </div>
                        </div>
                        Kurem ipsum dolor sit amet, consectetur adipiscinger elit. In mollis erat mattis neque facilisis, sit ameter ultricies erat rutrum. Cras facilisis, nulla vel viver auctor, leo magna sodales felis, quis malesuki
                        <a href="#" class="fa fa-share-square"></a>
                    </div>
                </div>
            </div>
            <div class="clear"></div>
        </div>
        <div class="c_phone">
            <div class="container_12">
                <div class="grid_12">
                    <div class="fa fa-phone"></div>+ 1800 559 6580
                    <span>ORDER NOW!</span>
                </div>
                <div class="clear"></div>
            </div>
        </div>

        <!--==============================Content=================================-->
        <div class="content"><div class="ic">More Website Templates @ TemplateMonster.com - April 07, 2014!</div>
            <div class="container_12">
                <div class="grid_5">
                    <h3>Booking Form</h3>
                    <div id="jeffsform">
                        <h:form>   
                            <p:wizard id="wizard">
                                <p:tab title="Booking" id="booking">
                                    <p:panel header="Booking">
                                        <p:messages/>
                                        <h:panelGrid columns="2">

                                            <h:outputLabel for="firstName" 
                                                           value="First Name" 
                                                           styleClass="requiredLbl"/>
                                            <h:inputText id="firstName" 
                                                         label="First Name" 
                                                         value="#{userBean.firstName}" 
                                                         required="true"/>
                                            <h:outputLabel for="lastName" 
                                                           value="Last Name" 
                                                           styleClass="requiredLbl"/>
                                            <h:inputText id="lastName" label="Last Name" 
                                                         value="#{userBean.lastName}" 
                                                         required="true"/>
                                            <h:outputLabel for="email" 
                                                           value="Email" 
                                                           styleClass="requiredLbl"/>
                                            <h:inputText id="email" label="Email" 
                                                         value="#{userBean.email}" 
                                                         required="true"/>


                                            <p:outputLabel for="timeOfDay" value="Time of Day:" />
                                            <p:selectOneRadio id="timeOfDay" value="#{userBean.timeOfDay}">
                                                <f:selectItem itemLabel="Morning" itemValue="Morning" />
                                                <f:selectItem itemLabel="Afternoon" itemValue="Afternoon" />
                                                <f:selectItem itemLabel="Evening" itemValue="Evening" />
                                            </p:selectOneRadio>


                                            <h:outputLabel for="checkout_date"
                                                           value="Checkout Date"
                                                           styleClass="requiredLbl"/>

                                            <p:calendar id="checkout_date"
                                                        label="Checkout Date"
                                                        value="#{userBean.checkout_date}"/>

                                            <h:outputLabel for="checkin_date"
                                                           value="Checkin Date"
                                                           styleClass="requiredLbl"/>

                                            <p:calendar id="checkin_date"
                                                        label="Checkin Date"
                                                        value="#{userBean.checkin_date}"/>
                                            <p:outputLabel for="type" value="Type:" />
                                            <p:selectOneRadio id="type" value="#{userBean.type}">
                                                <f:selectItem itemLabel="Cheap" itemValue="Cheap" />
                                                <f:selectItem itemLabel="Standard" itemValue="Standard" />
                                                <f:selectItem itemLabel="Lux" itemValue="Lux" />
                                            </p:selectOneRadio>
                                            <h:outputLabel for="adults" value="Adults:" />
                                            <p:spinner id="adults" value="#{userBean.numAdults}" />
                                            <h:outputLabel for="children" value="Children:" />
                                            <p:spinner id="children" value="#{userBean.numChildren}" />

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

                                <p:tab title="Payment" id="payment">
                                    <p:panel header="Booking">
                                        <p:messages/>
                                        <h:panelGrid columns="2">
                                            <h:outputLabel for="creditCard" 
                                                           value="Credit Card Number:" 
                                                           styleClass="requiredLbl"/>
                                            <h:inputText id="creditCard" 
                                                         label="Credit Card" 
                                                         value="#{userBean.creditCard}" 
                                                         required="true"/>
                                            <h:outputLabel for="address1" 
                                                           value="Address:" 
                                                           styleClass="requiredLbl"/>
                                            <h:inputText id="address1" 
                                                         label="address" 
                                                         value="#{userBean.address1}" 
                                                         required="true"/>
                                            <h:outputLabel for="address2" 
                                                           value="Address 2:" 
                                                           styleClass="requiredLbl"/>
                                            <h:inputText id="address2" 
                                                         label="address 2" 
                                                         value="#{userBean.address2}" 
                                                         required="true"/>
                                            <h:outputLabel for="city" 
                                                           value="City:" 
                                                           styleClass="requiredLbl"/>
                                            <h:inputText id="city" 
                                                         label="city" 
                                                         value="#{userBean.city}" 
                                                         required="true"/>
                                            <h:outputLabel for="state" 
                                                           value="State:" 
                                                           styleClass="requiredLbl"/>
                                            <h:inputText id="state" 
                                                         label="state" 
                                                         value="#{userBean.state}" 
                                                         required="true"/>
                                            <h:outputLabel for="zip" 
                                                           value="Zip:" 
                                                           styleClass="requiredLbl"/>
                                            <h:inputText id="zip" 
                                                         label="zip" 
                                                         value="#{userBean.zip}" 
                                                         required="true"/>
                                        </h:panelGrid>
                                    </p:panel>
                                </p:tab>
                                <p:tab title="Submit" id="submit">
                                    <p:panel header="Booking">
                                        <p:messages/>
                                        <h:panelGrid columns="2">
                                            <h:outputLabel for="message" 
                                                           value="Message:" 
                                                           styleClass="requiredLbl"/>
                                            <p:inputTextarea rows="10" cols="30" completeMethod="#{userBean.message}" />

                                            <h:outputLabel for="agree_terms" 
                                                           value="I have read and agree to terms: " 
                                                           styleClass="requiredLbl"/>
                                            <p:selectBooleanCheckbox value="#{userBean.agree_terms}" />

                                            <h:outputLabel for="total" 
                                                           value="Total:" 
                                                           styleClass="requiredLbl"/>
                                            <h:inputText id="total" 
                                                         label="total" 
                                                         value="#{userBean.total}" />
                                            <!--disabled="true"/>-->

                                            <p:commandButton id="submitButton" value="Submit" action="#{userBean.saveUser}"/>



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

                                </p:tab>


                            </p:wizard>
                        </h:form>
                    </div>
                </div>
                <div class="grid_6 prefix_1">
                    <a href="index2.html" class="type"><img src="images/page1_img1.jpg" alt=""/><span class="type_caption">Economy</span></a>
                    <a href="index2.html" class="type"><img src="images/page1_img2.jpg" alt=""/><span class="type_caption">Standard</span></a>
                    <a href="index2.html" class="type"><img src="images/page1_img3.jpg" alt=""/><span class="type_caption">Lux</span></a>
                </div>
                <div class="clear"></div>
            </div>
        </div>

        <!--==============================footer=================================-->
        <footer>
            <div class="container_12">
                <div class="grid_12">
                    <div class="f_phone"><span>Call Us:</span> + 1800 559 6580</div>
                    <div class="socials">
                        <a href="#" class="fa fa-twitter"></a>
                        <a href="#" class="fa fa-facebook"></a>
                        <a href="#" class="fa fa-google-plus"></a>
                    </div>
                    <div class="copy">
                        <div class="st1">
                            <div class="brand">Tour<span class="color1">T</span>axi </div>
                            &copy; 2014 | <a href="#">Privacy Policy</a> </div> Website designed by <a href="http://www.templatemonster.com/" rel="nofollow">TemplateMonster.com</a>
                    </div>
                </div>
                <div class="clear"></div>
            </div>
        </footer>














    </h:body>
</html>

1 个答案:

答案 0 :(得分:0)

在第二个例子中,我看到很多包含的javascript。 可能重复包括jquery或jquery版本冲突:

<script src="js/jquery.js"></script>

检查浏览器控制台是否有错误..