2 Replies Latest reply on May 18, 2010 1:17 AM by pankaj jain

    problem with navigation

    pankaj jain Newbie

      hi

       

      i have developed a jsp as following its name is menu.jsp

      <f:view>

      <rich:dropDownMenu  submitMode="server">
                          <f:facet  name="label">
                              <h:panelGroup>
                                   <h:outputText value="Inventory Control" />
                               </h:panelGroup>
                          </f:facet>
                           <rich:menuGroup value="Inventory Maintainces"  >
                               <rich:menuItem submitMode="Server" value="Finished Item"
                                   action="finisheditem" />
                               <rich:menuItem submitMode="Server" value="Labor code and charges "
                                   action="labor_code_charges" >
                               </rich:menuItem>
                              <rich:menuItem  submitMode="server" value="Metal code and prices"
                                   action="metal_code_prices">
                               </rich:menuItem>
                              <rich:menuItem  submitMode="server" value="Diamond codes and prices"
                                   action="diamond_code_prices">
                               </rich:menuItem>               
                       </rich:dropDownMenu>

      <f:view>

       

      my home  page is above one. and it shows the menu correctly .

       

       

       

      Now when user select "finisheditem"  for navigation its mapping is written in faces-config.xml as follows

       

       

      <?xml  version="1.0" encoding="UTF-8"?>

       

      <!DOCTYPE  faces-config PUBLIC
          "-//Sun Microsystems, Inc.//DTD JavaServer  Faces Config 1.1//EN"
           "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">

       

      <faces-config>
           <navigation-rule>   
         
           <from-view-id>/jsp/common/menu.jsp</from-view-id>            
              <navigation-case>
                   <from-outcome>Home</from-outcome>
                   <to-view-id>/jsp/common/home.jsp</to-view-id>
               </navigation-case>
         
         
          <navigation-case>
                   <from-outcome>finisheditem</from-outcome>
                   <to-view-id>/jsp/inventory/finished_items/finisheditem.jsp</to-view-id>
               </navigation-case>
             
          <navigation-case>
                   <from-outcome>metal_code_prices</from-outcome>
                   <to-view-id>/jsp/inventory/metal_codes_prices/metal_ code  _prices.jsp</to-view-id>
              </navigation-case>   
          
         
          <navigation-case>
                   <from-outcome>labor_code_charges</from-outcome>
                   <to-view-id>/jsp/inventory/labor_ code _charges/labor_ code  _charges.jsp</to-view-id>
              </navigation-case>
          
         
          <navigation-case>
                   <from-outcome>diamond_code_prices</from-outcome>
                   <to-view-id>/jsp/inventory/diamond_codes_prices/diamond_ code  _prices.jsp</to-view-id>
          </navigation-case>
         
          
          <navigation-case>
                   <from-outcome>color_stone_code_prices</from-outcome>
                    <to-view-id>/jsp/inventory/color_stone_code_prices/color_stone_code_prices.jsp</to-view-id>
           </navigation-case>
             
         
           <navigation-case>
                   <from-outcome>diamond_inventory</from-outcome>
                    <to-view-id>/jsp/inventory/diamond/diamond_inventory.jsp</to-view-id>
           </navigation-case>   
      </navigation-rule>

      </faces-config>

       

       

      menu.jsp  is a file which must present in each jsp as it contain menu. and i have  include it in following way say finisheitem.jsp

       

      but i  am getting the following error

       

       

       

       

      javax.servlet.ServletException:  javax.servlet.jsp.JspException: Exception attemtping to write content  above the <f:view> tag.

       

      plz tell me what is the exact problem is ...

        • 1. Re: problem with navigation
          praveen jain Novice

          as you are inlcuding the menu.jsp to each page, check out the f:view tag it must not be nested.

          it should solve your problem , otherwise u need to send code of your page in which you are including your menu.jsp

          • 2. Re: problem with navigation
            pankaj jain Newbie

            following is my jsp file in which i included menu.jsp

             

             

                <%@ page language="java" contentType="text/html; charset=ISO-8859-1"

                pageEncoding="ISO-8859-1"%>

            <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

             

             

             

             

             

            <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>

            <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>

            <!-- RichFaces tag library declaration -->

            <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>

            <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

             

            <html>

            <head>

            <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

            <title>Gold-N-Diamond</title>

            <style type="text/css">

            .right {

                position: absolute;

                right: 25px;

                width: 270px;

                top: 280px;

                background-color: #b0e0e6;

            }

             

            .right_itemtable {

                position: absolute;

                right: 40px;

                top: 790px;

                background-color: #b0e0e6;

            }

             

            </style>

            </head>

            <body>

             

                <jsp:include page="/jsp/common/menu.jsp" />  //as per your instruction i put it above <f:view>

                                                                                    // but let me tell you how it is working now , described below  

             

             

            <f:view>

             

             

             

                <h:form>

             

                    <rich:panel>

                        <!-- Functional Buttons -->

             

             

             

                        <!-- Common information  -->

             

                        <rich:panel>

             

                            <h:panelGrid columns="4">

             

                                <h:panelGrid columns="2">

             

                                    <h:outputText value="Item No:" />

             

                                    <h:outputText value="PCL649/W" />

             

                                    <h:outputText value="  Description:" />

             

                                    <h:inputText value="2.00CT-DIA INVISIBLE RING" id="description"  style="width:180px"/>

             

                                </h:panelGrid>

             

                                <h:panelGrid columns="2">

                                    <h:outputText value="Item Type:" />

                                    <rich:comboBox defaultLabel="CAT09-CATALOG2009">

                                        <f:selectItem itemValue="CAT09-CATALOG2009" />

                                        <f:selectItem itemValue="BRIDO8PO4-Bridal Flyer 2009" />

                                    </rich:comboBox>

             

                                    <h:outputText value="Item Class:        " />

                                    <rich:comboBox defaultLabel="Bangle-Ladies Bangle">

                                        <f:selectItem itemValue="Bangle-Ladies Bangle" />

                                        <f:selectItem itemValue="DIA-Loose Diamond" />

                                    </rich:comboBox>           

                                </h:panelGrid>

             

                                <h:panelGrid columns="2">

                                    <h:outputText value="Product Line:      " />

                                    <rich:comboBox

                                        defaultLabel="3SPPC-3 Stone Princess Pendant 1.00ct">

                                        <f:selectItem itemValue="3SPPC-3 Stone Princess Pendant 1.00ct" />

                                        <f:selectItem itemValue="3SPPH-3 Stone Princess 9Pendant 0.50ct" />

                                    </rich:comboBox>

                                    <h:outputText value="Price group:      " />

                                    <rich:comboBox defaultLabel="Val091P">

                                        <f:selectItem itemValue="Val0901P" />

                                    </rich:comboBox>

                                </h:panelGrid>   

                                <h:panelGrid columns="2">

                                <h:outputText value="Diamond Type:      " />

                                    <rich:comboBox defaultLabel="BlackPR">

                                        <f:selectItem itemValue="BlackPR" />

                                        <f:selectItem itemValue="BlackRD" />

                                    </rich:comboBox>

                                <h:outputText value="Warehouse:" />

                                    <rich:comboBox defaultLabel="Main">

                                        <f:selectItem itemValue="Main" />

                                        <f:selectItem itemValue="W-REP" />

                                        <f:selectItem itemValue="Remote" />

                                        <f:selectItem itemValue="Metal" />

                                    </rich:comboBox>

                                </h:panelGrid>

             

             

                            </h:panelGrid>

                        </rich:panel>

             

             

             

             

                    </rich:panel>

             

                </h:form>

             

                </f:view>

             

                <jsp:include page="/jsp/common/footer.jsp" />

             

             

             

             

             

                </body>

             

                </html>

             

             

            first is displayed menu.jsp as a home page. when i click on finished item , it goes to finisheditem.jsp but it shows the content of footer.jsp(dynamically included in above code) only . It skips the content of menu.jsp and content of finisheditem.jsp as well.