7 Replies Latest reply on Apr 24, 2007 7:23 AM by deeprajlondhe

    how to add dynamic data in tabpane

    deeprajlondhe

       

      "deeprajlondhe" wrote:
      i am using your product richfaces
      i am facing problem when i use tabpane.
      in tabane i use dynamic data ,call in each tab.
      i use two files.
      like file1.jsp
      file2.jsp
      i included these files in tab using <c:import/>
      but this is not working properly.
      when i click on tab open a perticular window but when i press save button form redirected to another page.
      please help me
      thanks


        • 1. Re:  how to add dynamic data in tabpane
          ilya_shaikovsky

          provide please more detailes like code, settings etc.

          • 2. Re:  how to add dynamic data in tabpane
            deeprajlondhe

            in tabpane i open file.jsp
            it contains data ajax enable

            code of file.jsp

            <h:form styleClass="FormBackground" id="RoleTableForm" style="width:40%">
            <rich:datascroller for="MasterTable" maxPages="20"/>
            <rich:spacer height="30"/>
            <rich:dataTable styleClass="DataTable"
            width="483" id="MasterTable" rows="5"
            columnClasses="col"
            value="#{RoleManager.roleMasterList}"
            headerClass="DataTableHeader"
            rowClasses="DataRowReg,DataRowAlternate"
            var="list">

            <f:facet name="header">
            <rich:columnGroup>
            <rich:column>
            <h:outputText styleClass="headerText" value="Role Code" />
            </rich:column>
            <rich:column>
            <h:outputText styleClass="headerText" value="Role Name" />
            </rich:column>
            <rich:column>
            <h:outputText styleClass="headerText" value="Status" />
            </rich:column>
            </rich:columnGroup>
            </f:facet>
            <rich:column>
            <h:outputText id="rolecode" value="#{list.roleCode}"/>
            <h:inputHidden id="roleid" value="#{list.roleId}"/>
            <h:inputHidden id="roledesc" value="#{list.roleDesc}"/>
            </rich:column>
            <rich:column>
            <h:outputText id="rolename" value="#{list.roleName}" />
            </rich:column>
            <rich:column>
            <h:outputText id="rolestatus" value="#{list.roleStatus}"/>
            </rich:column>
            <rich:column>
            <h:commandLink value="Edit" actionListener="#{RoleManager.callEdit}" />
            </rich:column>
            <rich:column>
            <h:commandLink value="Delete" actionListener="#{RoleManager.deleteRole}"/>
            </rich:column>
            </rich:dataTable>
            </h:form>


            how i solve this problem

            • 3. Re:  how to add dynamic data in tabpane
              ilya_shaikovsky

              Sorry but seems I've lost your points. In the listing you've provided there is no tabs and as far as I understood this is an imported page. so then I didn't see "Save" button you've previously described :/

              Sorry but please repeate your case carefully step by step(what did you perform, the way you use, and the results you need and you get) to introduce the problem.

              • 4. Re:  how to add dynamic data in tabpane
                deeprajlondhe

                i am use netbeans 5.5,
                ajax4jsf
                richfaces

                i want to open files in diffrent tabs.

                mycode is like this

                jsp page:

                <rich:tabpane>
                <rich:tab name="tab1">
                <c:import page="file.jsp"/>
                </rich:tab>
                <rich:tab name="tab2">
                <c:import page="somepage.jsp"/>
                </rich:tab>
                </rich:tabpane>

                when i open this page it will show two tabs when i click on one of the tab it will open respective tab.
                but when i working(like save,clear form) on that open page it will redirected to some other page
                how i resolve this.



                file.jsp

                described before
                this post

                • 5. Re:  how to add dynamic data in tabpane
                  deeprajlondhe

                  i use rich faces tab control and open diffrent files in diff tabs.
                  but the problem is the tab is displayed along with respective files but when i click on save,new,edit it will redirect to some another page
                  how i solve this issue.
                  code:




                  <%@ taglib prefix ="f" uri="http://java.sun.com/jsf/core"%>
                  <%@ taglib prefix ="h" uri="http://java.sun.com/jsf/html"%>
                  <%@ taglib prefix ="c" uri="http://java.sun.com/jsp/jstl/core" %>
                  <%@ taglib prefix ="rich" uri="http://richfaces.ajax4jsf.org/rich" %>


                  <%@ page contentType="text/html"%>
                  <%@ page pageEncoding="UTF-8"%>

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

                  <f:view>


                  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                  JSP Page


                  <jsp:include page="header.jsp"/>
                  <rich:tabPanel>
                  <rich:tab name="tab1">
                  <jsp:include page="Role.jsp"/>
                  </rich:tab>
                  <rich:tab name="tab2">
                  <jsp:include page="User.jsp"/>
                  </rich:tab>
                  </rich:tabPanel>


                  </f:view>

                  • 6. Re:  how to add dynamic data in tabpane
                    deeprajlondhe

                    <%@ taglib prefix ="f" uri="http://java.sun.com/jsf/core"%>
                    <%@ taglib prefix ="h" uri="http://java.sun.com/jsf/html"%>
                    <%@ taglib prefix="rich" uri="http://richfaces.ajax4jsf.org/rich"%>
                    <%@ taglib prefix="a4j" uri="https://ajax4jsf.dev.java.net/ajax"%>

                    <%@ page contentType="text/html"%>
                    <%@ page pageEncoding="UTF-8"%>

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

                    <f:view>


                    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                    JSP Page



                    function clearField()
                    {
                    document.getElementById('RoleForm:rolecode').value ="";
                    document.getElementById('RoleForm:rolename').value ="";
                    document.getElementById('RoleForm:description').value ="";
                    document.getElementById('RoleForm:status').value ="";
                    }



                    <jsp:include page="header.jsp"/>

                    <h:form styleClass="FormBackground" id="RoleTableForm" style="width:40%">
                    <rich:datascroller for="MasterTable" maxPages="20"/>
                    <rich:spacer height="30"/>
                    <rich:dataTable id="MasterTable" onRowClick="this.style.backgroundColor='red'"
                    styleClass="DataTable"
                    width="483" rows="5"
                    value="#{RoleManager.roleMasterList}"
                    headerClass="DataTableHeader"
                    columnClasses="col"
                    rowClasses="DataRowReg,DataRowAlternate"
                    var="list">

                    <f:facet name="header">
                    <rich:columnGroup>
                    <h:column>
                    <h:outputText styleClass="headerText" value="Role Code" />
                    </h:column>
                    <h:column>
                    <h:outputText styleClass="headerText" value="Role Name" />
                    </h:column>
                    <h:column>
                    <h:outputText styleClass="headerText" value="Status" />
                    </h:column>
                    </rich:columnGroup>
                    </f:facet>
                    <h:column>
                    <h:outputText id="rolecode" value="#{list.roleCode}"/>
                    <h:inputHidden id="roleid" value="#{list.roleId}"/>
                    <h:inputHidden id="roledesc" value="#{list.roleDesc}"/>
                    </h:column>
                    <h:column>
                    <h:outputText id="rolename" value="#{list.roleName}" />
                    </h:column>
                    <h:column>
                    <h:outputText id="rolestatus" value="#{list.roleStatus}"/>
                    </h:column>
                    <h:column>
                    <h:commandLink actionListener="#{RoleManager.callEdit}">
                    <h:outputText id="edit" value="Edit"/>
                    </h:commandLink>
                    </h:column>
                    <h:column>
                    <h:commandLink value="Delete" actionListener="#{RoleManager.deleteRole}" />
                    </h:column>

                    <f:facet name="footer">
                    <h:panelGroup style="align:right">
                    <h:commandButton value="New" styleClass="Button"
                    actionListener="#{RoleManager.callNew}"/>
                    <h:commandButton id="mapuser" type="submit" value="Map Users"
                    actionListener="#{RoleManager.mapUser}"
                    disabled="#{RoleManager.flag}" styleClass="Button"/>
                    </h:panelGroup>
                    </f:facet>
                    </rich:dataTable>
                    </h:form>

                    <h:form styleClass="FormBackground" id="RoleForm" style="width:50%" rendered="#{RoleManager.render}">
                    <h:outputText styleClass ="FormTitle" value ="Role Maintenance"/>




                    <h:outputText styleClass="InputLabel" value="RoleCode:"/>


                    <h:inputText id="rolecode" required="true"
                    styleClass="EditField" value="#{RoleManager.role.roleCode}"
                    onkeyup="javascript:this.value=this.value.toUpperCase();"
                    size="37">
                    <f:validateLength maximum="5"/>
                    </h:inputText>




                    <h:outputText styleClass="InputLabel" value="RoleName:"/>


                    <h:inputText id="rolename" styleClass="EditField"
                    required="true"
                    maxlength="8"
                    onkeyup="javascript:this.value=this.value.toUpperCase();"
                    value="#{RoleManager.role.roleName}" size="37"/>




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


                    <h:inputTextarea id="description" styleClass="EditField" cols="40" rows="5"
                    onkeyup="javascript:this.value=this.value.toUpperCase();"
                    value="#{RoleManager.role.roleDesc}"/>




                    <h:outputText styleClass="InputLabel" value="Status:"/>


                    <h:selectOneMenu id="status" required="true" value="#{RoleManager.role.roleStatus}"
                    styleClass="ListBox" style="width:100%">
                    <f:selectItem itemLabel ="Active" itemValue="A"/>
                    <f:selectItem itemLabel ="InActive" itemValue="I"/>
                    <f:selectItem itemLabel ="Suspended" itemValue="S"/>
                    </h:selectOneMenu>









                    <h:commandButton id="save" type="submit" value="Save"
                    styleClass="Button" action="#{RoleManager.addRole}"/>
                    <h:commandButton id="clear" type="submit" value="Clear" styleClass="Button"
                    onclick="clearField();" />



                    </h:form>

                    <h:form styleClass="FormBackground" id="MapRoleForm" style="width:50%" rendered="#{RoleManager.mapRole}">
                    <h:dataTable id="RoleTable" value="#{RoleManager.roleList}"
                    var="list" width="400"
                    styleClass="DataTable"
                    headerClass="DataTableHeader"
                    rowClasses="DataRowReg,DataRowAlternate">
                    <h:column>
                    <f:facet name="header">
                    <h:outputText styleClass="InputLabel" value="User Name"/>
                    </f:facet>
                    <h:outputText styleClass="InputLabel" value="#{list.userName}"/>
                    </h:column>

                    <h:column>
                    <f:facet name="header">
                    <h:outputText styleClass="InputLabel" value="RoleId"/>
                    </f:facet>
                    <h:outputText id="roleid" value="#{RoleManager.role.roleId}"/>
                    </h:column>


                    <h:column>
                    <f:facet name="header">
                    <h:outputText styleClass="InputLabel" value="UserId"/>
                    </f:facet>
                    <h:outputText id="userid" value="#{list.userId}"/>
                    </h:column>

                    <h:column>
                    <f:facet name="header">
                    <h:outputText styleClass="InputLabel" value="Role"/>
                    </f:facet>
                    <h:selectBooleanCheckbox value="#{list.available}"/>
                    </h:column>

                    <h:column>
                    <f:facet name="header">
                    <h:outputText styleClass="InputLabel" value="OriRole"/>
                    </f:facet>
                    <h:outputText styleClass="InputLabel" value="#{list.oriRole}"/>
                    </h:column>

                    </h:dataTable>




                    <h:commandButton id="saveButton" type="submit" value="Save"
                    styleClass="Button" action="#{RoleManager.addUserRoles}"/>
                    <h:commandButton id="clearButton" styleClass="Button" type="submit" value="Clear"
                    action="#{RoleManager.clear}"/>



                    </h:form>
                    <h:outputLabel id="message" styleClass="ErrorMessage" value="#{RoleManager.message}"/>



                    </f:view>

                    • 7. Re:  how to add dynamic data in tabpane
                      deeprajlondhe

                      <%@ taglib prefix ="f" uri="http://java.sun.com/jsf/core"%>
                      <%@ taglib prefix ="h" uri="http://java.sun.com/jsf/html"%>
                      <%@ taglib prefix="rich" uri="http://richfaces.ajax4jsf.org/rich"%>
                      <%@ taglib prefix="a4j" uri="https://ajax4jsf.dev.java.net/ajax"%>

                      <%@ page contentType="text/html"%>
                      <%@ page pageEncoding="UTF-8"%>

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

                      <f:view>


                      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                      JSP Page



                      function clearField()
                      {
                      document.getElementById('RoleForm:rolecode').value ="";
                      document.getElementById('RoleForm:rolename').value ="";
                      document.getElementById('RoleForm:description').value ="";
                      document.getElementById('RoleForm:status').value ="";
                      }



                      <jsp:include page="header.jsp"/>

                      <h:form styleClass="FormBackground" id="RoleTableForm" style="width:40%">
                      <rich:datascroller for="MasterTable" maxPages="20"/>
                      <rich:spacer height="30"/>
                      <rich:dataTable id="MasterTable" onRowClick="this.style.backgroundColor='red'"
                      styleClass="DataTable"
                      width="483" rows="5"
                      value="#{RoleManager.roleMasterList}"
                      headerClass="DataTableHeader"
                      columnClasses="col"
                      rowClasses="DataRowReg,DataRowAlternate"
                      var="list">

                      <f:facet name="header">
                      <rich:columnGroup>
                      <h:column>
                      <h:outputText styleClass="headerText" value="Role Code" />
                      </h:column>
                      <h:column>
                      <h:outputText styleClass="headerText" value="Role Name" />
                      </h:column>
                      <h:column>
                      <h:outputText styleClass="headerText" value="Status" />
                      </h:column>
                      </rich:columnGroup>
                      </f:facet>
                      <h:column>
                      <h:outputText id="rolecode" value="#{list.roleCode}"/>
                      <h:inputHidden id="roleid" value="#{list.roleId}"/>
                      <h:inputHidden id="roledesc" value="#{list.roleDesc}"/>
                      </h:column>
                      <h:column>
                      <h:outputText id="rolename" value="#{list.roleName}" />
                      </h:column>
                      <h:column>
                      <h:outputText id="rolestatus" value="#{list.roleStatus}"/>
                      </h:column>
                      <h:column>
                      <h:commandLink actionListener="#{RoleManager.callEdit}">
                      <h:outputText id="edit" value="Edit"/>
                      </h:commandLink>
                      </h:column>
                      <h:column>
                      <h:commandLink value="Delete" actionListener="#{RoleManager.deleteRole}" />
                      </h:column>

                      <f:facet name="footer">
                      <h:panelGroup style="align:right">
                      <h:commandButton value="New" styleClass="Button"
                      actionListener="#{RoleManager.callNew}"/>
                      <h:commandButton id="mapuser" type="submit" value="Map Users"
                      actionListener="#{RoleManager.mapUser}"
                      disabled="#{RoleManager.flag}" styleClass="Button"/>
                      </h:panelGroup>
                      </f:facet>
                      </rich:dataTable>
                      </h:form>

                      <h:form styleClass="FormBackground" id="RoleForm" style="width:50%" rendered="#{RoleManager.render}">
                      <h:outputText styleClass ="FormTitle" value ="Role Maintenance"/>




                      <h:outputText styleClass="InputLabel" value="RoleCode:"/>


                      <h:inputText id="rolecode" required="true"
                      styleClass="EditField" value="#{RoleManager.role.roleCode}"
                      onkeyup="javascript:this.value=this.value.toUpperCase();"
                      size="37">
                      <f:validateLength maximum="5"/>
                      </h:inputText>




                      <h:outputText styleClass="InputLabel" value="RoleName:"/>


                      <h:inputText id="rolename" styleClass="EditField"
                      required="true"
                      maxlength="8"
                      onkeyup="javascript:this.value=this.value.toUpperCase();"
                      value="#{RoleManager.role.roleName}" size="37"/>




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


                      <h:inputTextarea id="description" styleClass="EditField" cols="40" rows="5"
                      onkeyup="javascript:this.value=this.value.toUpperCase();"
                      value="#{RoleManager.role.roleDesc}"/>




                      <h:outputText styleClass="InputLabel" value="Status:"/>


                      <h:selectOneMenu id="status" required="true" value="#{RoleManager.role.roleStatus}"
                      styleClass="ListBox" style="width:100%">
                      <f:selectItem itemLabel ="Active" itemValue="A"/>
                      <f:selectItem itemLabel ="InActive" itemValue="I"/>
                      <f:selectItem itemLabel ="Suspended" itemValue="S"/>
                      </h:selectOneMenu>









                      <h:commandButton id="save" type="submit" value="Save"
                      styleClass="Button" action="#{RoleManager.addRole}"/>
                      <h:commandButton id="clear" type="submit" value="Clear" styleClass="Button"
                      onclick="clearField();" />



                      </h:form>

                      <h:form styleClass="FormBackground" id="MapRoleForm" style="width:50%" rendered="#{RoleManager.mapRole}">
                      <h:dataTable id="RoleTable" value="#{RoleManager.roleList}"
                      var="list" width="400"
                      styleClass="DataTable"
                      headerClass="DataTableHeader"
                      rowClasses="DataRowReg,DataRowAlternate">
                      <h:column>
                      <f:facet name="header">
                      <h:outputText styleClass="InputLabel" value="User Name"/>
                      </f:facet>
                      <h:outputText styleClass="InputLabel" value="#{list.userName}"/>
                      </h:column>

                      <h:column>
                      <f:facet name="header">
                      <h:outputText styleClass="InputLabel" value="RoleId"/>
                      </f:facet>
                      <h:outputText id="roleid" value="#{RoleManager.role.roleId}"/>
                      </h:column>


                      <h:column>
                      <f:facet name="header">
                      <h:outputText styleClass="InputLabel" value="UserId"/>
                      </f:facet>
                      <h:outputText id="userid" value="#{list.userId}"/>
                      </h:column>

                      <h:column>
                      <f:facet name="header">
                      <h:outputText styleClass="InputLabel" value="Role"/>
                      </f:facet>
                      <h:selectBooleanCheckbox value="#{list.available}"/>
                      </h:column>

                      <h:column>
                      <f:facet name="header">
                      <h:outputText styleClass="InputLabel" value="OriRole"/>
                      </f:facet>
                      <h:outputText styleClass="InputLabel" value="#{list.oriRole}"/>
                      </h:column>

                      </h:dataTable>




                      <h:commandButton id="saveButton" type="submit" value="Save"
                      styleClass="Button" action="#{RoleManager.addUserRoles}"/>
                      <h:commandButton id="clearButton" styleClass="Button" type="submit" value="Clear"
                      action="#{RoleManager.clear}"/>



                      </h:form>
                      <h:outputLabel id="message" styleClass="ErrorMessage" value="#{RoleManager.message}"/>



                      </f:view>