JSF Iterator Component

I was looking for a quick solution for a JSF iterator, because i dont want to use the h:dataTable i have to write my own component, and here is what i came up with.
public class JSFUIDataIterator extends UIData{
    public void encodeChildren(FacesContext oContext) throws IOException {
      if (oContext == null){
        throw new NullPointerException();
      int iProcessed = 0;
      int iRowIndex = getFirst() - 1;
      int iRows = getRows();
      Iterator oKids = getChildren(this);
      do{
        if(iRows > 0 && ++iProcessed > iRows)
          break;
        setRowIndex(++iRowIndex);
        if (!isRowAvailable())
          break;
        for(; oKids.hasNext();){
          UIComponent oKid = (UIComponent)oKids.next(); 
          encodeRecursive(oContext,oKid);
      } while(true);
    protected Iterator getChildren(UIComponent oComponent){
        List oResults = new ArrayList();
        for(Iterator oKids = oComponent.getChildren().iterator(); oKids.hasNext();){
          UIComponent oKid = (UIComponent)oKids.next();
          if(oKid.isRendered())
             oResults.add(oKid);
        return oResults.iterator();
    private void encodeRecursive(FacesContext oContext,UIComponent oComponent) throws IOException{
       if (!oComponent.isRendered()){
         return; 
       oComponent.encodeBegin(oContext);
       if (oComponent.getRendersChildren()){
         oComponent.encodeChildren(oContext);
       else{
         Iterator oChildren = getChildren(oComponent);
         for(;oChildren.hasNext();){
           UIComponent oChildComponent = (UIComponent)oChildren.next();
           encodeRecursive(oContext,oChildComponent);
       oComponent.encodeEnd(oContext);
}not want to be bothered by creating a renderer this component will render itself, but there is a problem, even though its iterating all the data elements its displaying the first data item. i missed something minor that i cant figure out. can anyone help?

I haven't got a reply so i went to look at my code again, and i managed to identify the problem.
I hope this code will help all those who want to use the iterator tag in JSF.
this simple custom component will give you more control over your data elements
here is the code for the custom component.
  public class DataIterator extends UIData{
    public void encodeChildren(FacesContext oContext) throws IOException {
      if (oContext == null){
        throw new NullPointerException();
      int iProcessed = 0;
      int iRowIndex = getFirst() - 1;
      int iRows = getRows();
      do{
        if(iRows > 0 && ++iProcessed > iRows)
          break;
        setRowIndex(++iRowIndex);
        if (!isRowAvailable())
          break;
        Iterator oKids = getChildren(this);
        for(; oKids.hasNext();){
          UIComponent oKid = (UIComponent)oKids.next(); 
          encodeRecursive(oContext,oKid);
      } while(true);
    protected Iterator getChildren(UIComponent oComponent){
        List oResults = new ArrayList();
        for(Iterator oKids = oComponent.getChildren().iterator(); oKids.hasNext();){
          UIComponent oKid = (UIComponent)oKids.next();
          if(oKid.isRendered())
             oResults.add(oKid);
        return oResults.iterator();
    private void encodeRecursive(FacesContext oContext,UIComponent oComponent) throws IOException{
       if (!oComponent.isRendered()){
         return; 
       oComponent.encodeBegin(oContext);
       if (oComponent.getRendersChildren()){
         oComponent.encodeChildren(oContext);
       else{
         Iterator oChildren = getChildren(oComponent);
         for(;oChildren.hasNext();){
           UIComponent oChildComponent = (UIComponent)oChildren.next();
           encodeRecursive(oContext,oChildComponent);
       oComponent.encodeEnd(oContext);
  }you only need these three methods in your component, i have stripped out logging and comments to keep the size of this post smaller, the rest is pretty straight forward.
you need a CustomTag class for the component and it should at least take two attributes : items and var.
your tag library should look something like this:
    <name>forEach</name>
    <tag-class>myjsf.DataIteratorTag</tag-class>
    <body-content>JSP</body-content>
    <attribute>
      <name>items</name>
      <required>true</required>
      <rtexprvalue>true</rtexprvalue>
      <type>java.lang.String</type>
    </attribute>
    <attribute>
      <name>var</name>
      <required>true</required>
      <rtexprvalue>false</rtexprvalue>
      <type>java.lang.String</type>
    </attribute>in the jsp page here is my sample file:
<%@taglib uri="/WEB-INF/data-iterator.tld" prefix="tbc" %>
   <faces:view>
     <faces:verbatim>
       <table>
     </faces:verbatim>
     <tbc:forEach items="#{myCollection.musicTitles}" var="oRow">
      <faces:verbatim>
        <tr style="background-color:#EEEEEE;">
          <td>
      </faces:verbatim>
      <html:outputText value="#{oRow}"/>
     <faces:verbatim>
          </td>
        </tr>
     </faces:verbatim>
     </tbc:forEach>
     <faces:verbatim>
       </table>
     </faces:verbatim>

Similar Messages

  • Parent Child Synchronization using a Iterator Component

    Hi All,
    I am working on ADF 11.1.1.5.0. I have the following business requirement :
    I have DepartmentVO and EmployeeVO with a view link defined on DepartmentId attribute.
    Use Case : I need to display all departments with their respective childs with a specific UI design i.e. i need to show all the Departments as Panel boxes and their respective children inside the panel box.
    So for that i have used the Iterator component which will dynamically create Panel boxes based on the rowcount of DepartmentVO .(if there are 5 records in dept table then 5 panel boxes will be formed).
    Similarly for child i have used another Iterator component(inside parent Iterator) which will display its respective children.
    jspx code is as follows :
    <af:panelGroupLayout id="pgl1" layout="scroll">
    <af:iterator id="i2" value="#{bindings.DepartmentsView1.collectionModel}"
    var="row">
    <af:panelBox text="#{row.DepartmentId} -- #{row.DepartmentName}" id="pb1" styleClass="AFStretchWidth">
    <af:panelGroupLayout id="pgl3">
    <af:iterator id="i1" value="#{bindings.EmployeesView3.collectionModel}"
    var="attr">
    <af:outputText value="#{attr.DepartmentId}" id="ot1"/>
    <af:outputText value="#{attr.FirstName}" id="outputText1"/>
    <af:outputText value="#{attr.LastName}" id="outputText2"/>
    </af:iterator>
    </af:panelGroupLayout>
    </af:panelBox>
    </af:iterator>
    </af:panelGroupLayout>
    When i run the page i see all the parent records as panel boxes but child records are not properly synchronized. The children of first parent is getting repeated inside all parents.This probably is the first parent is set as current row for which its children get repeated in all other parents.
    If i run the same through AppModule it runs perfectly as in appmodule run we hv a NEXT button to iterate the Parent VO.
    Thnks
    -Sanjeeb

    HI ,
    Instead of what you have tried, you can try this. EmployeesView here should be present as a child accessor in DepartmentsView.
    <af:iterator id="i2"
    value="#{bindings.DepartmentsView1.collectionModel}"
    var="row">
    <af:panelBox text="#{row.DepartmentId} --#{row.DepartmentName}"
    id="pb1" styleClass="AFStretchWidth">
    <af:panelGroupLayout id="pgl3" layout="vertical">
    <af:iterator id="i1" value="#{row.EmployeesView}" var="attr">
    <af:panelGroupLayout id="pgl0" layout="horizontal">
    <af:outputText value="#{attr.FirstName}" id="outputText1"/>
    <af:outputText value="#{attr.EmployeeId}" id="outputText2"/>
    <af:outputText value="#{attr.LastName}" id="outputText3"/>
    </af:panelGroupLayout>
    </af:iterator>
    </af:panelGroupLayout>
    </af:panelBox>
    </af:iterator>
    Hope this anwsers your question.
    Thanks,
    TJ

  • JSF custom component

    Hi
    I have created a JSF cutom component , which has some javascript files. If i use the component within the same project my path for accessing the JS files is :- js/task.js (Its in public/html folder) .
    My problem is that when I use this custom component in some other project i am not able to access the js file ( Js file are deployed with other source file in ADF Library Jar) . As I have to hard code the path of JS files in the render can any one please tell me what will be the path for accessing the JS files.
    i heard ADFLibraryFilter is used for the purpose. Anyone please shed more light on it.

    Thanx Frank for your help .
    I am generating html from the rendererm, in the encodeBegin method i have now written <script type="text/javascript" src="adflibResources/js/task.js"></script>
    But still the script isn't loading on the page
    I added the following code in web.xml but Jdeveloper (Studio Edition Version 11.1.1.1.0) is complaining that "refernce oracle.adf.library.webapp.LibraryFilter and oracle.adf.library.webapp.ResourceServlet not found. I am using Fusion Web Application (ADF) as the application template.
    <filter>
    <filter-name>ADFLibraryFilter</filter-name>
    <filter-class>oracle.adf.library.webapp.LibraryFilter</filter-class>
    <init-param>
    <param-name>provider-lazy-inited</param-name>
    <param-value>true</param-value>
    </init-param>
    </filter>
    <filter-mapping>
    <filter-name>ADFLibraryFilter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
    </filter-mapping>
    <servlet>
    <servlet-name>adflibResources</servlet-name>
    <servlet-class>oracle.adf.library.webapp.ResourceServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>adflibResources</servlet-name>
    <url-pattern>/adflib/*</url-pattern>
    </servlet-mapping>

  • JSF Declarative Component

    hi every body
    i am using Oracle Jdeveloper 11g release 2
    i wanted to create a Calendar Component
    for this i used JSF Declarative Component
    i added a RichInputText to page and a Button for opening calendar Dialog
    when for first time i open Calendar Dialog and select a day ,
    value of this day return to RichInputText truly but
    when i wanna to open it for second time that has an error
    error is:
    Error:dateValue is Read only
    i have to tell you dateValue is name of Attribute on JSF Declarative Component
    can anybody help me?

    i found a solution for this problem
    thanks

  • JSF Menu Component

    Hello Suners,
    I'm developing a JEE application and using mojarra jsf implementation. I need to find a JSF Menu component that i can use in my app.
    Regards,

    abulseed wrote:
    I need to find a JSF Menu component that i can use in my app.You would be better off creating your menus using Cascading Style Sheets (CSS). JSF menuing often involves JavaScript of some sort which won't work if the user has JavaScript turned off. CSS menuing guarantees that your menu always work (even with Javascript turned off) and it's better by design, not to mention less annoying to users.
    Googled for 'CSS menu' - there are heaps of examples out there that you can use.
    Edited by: user2412 on Apr 5, 2011 12:30 AM

  • JSF table component with paging

    Are you aware of any existing JSF table component with both navigation and paging ?
    I want to display the content of a database table with a large number of rows. The table component should be able to navigate through the entire table content, but building only a small ResultSet and dinamically populate it with data as we perform navigation.
    Thanks,
    Cosmin

    Thanks for the answer.
    But data scroller just takes a ResultSet and display it with navigation. It doesn't know about the total number of rows in the table. It only display the number of records in the ResultSet.
    What I am looking for is a data scroller which based on some input parameters knows how to split the table in several ResultSets, dinamically change the ResultSet and display the total number of rows in the table and not in the current ResultSet.

  • JSF Tab component and Dynamic Faces AjaxZone

    Has anyone tried to use a JSF Tab Component in a Dynamic Faces Ajax Zone. I would like to try to have a page that has a list of the alphabet, each tab being one letter and then adding terms an definitions to each tab. Do you have any comments or suggestions regarding doing this. I am at a loss as to how to make the tab component respond when clicking on it in the ajaxZone. any help would be appreciated. thnx

    The Scales and Tomahawk libraries provides a tabbed panel.
    But basically tabs are nothing less or more than a bunch of block elements layered over each other with the same amount of buttons or links at the top. If a tab click doesn't require a trip to the server, then you can just load all tab blocks at once and use Javascript+DOM to switch between tab blocks, e.g. one block should be displayed using element.style.display='block' and all other blocks should be hidden using element.style.display='none'. If a tab click require a trip to the server (to preinitialize stuff or so), then you can use the 'rendered' property of the tab block element (which can be <h:panelGroup style="display:block;" rendered="#{myBean.showTab == 1}" /> or so).
    For styling of the tab blocks and tab buttons/links just use CSS.

  • JSF Calendar Component JS error

    Hi everyone,
    I have problem with JSF Calendar component. JSP version is 1.2 so we are using com.sun.rave.web.ui.component.Calendar class.
    When HTML code is generated some id missing. For example:
    JavaScript tries to find subForm:startCalendar:_datePicker:row5, but there is only subForm:startCalendar:_datePicker:row4.
    This cause JS error at line 249 in calendar.js:
    this.lastRow = document.getElementById(rowId);
    this.lastRow.style.display = "none"; //error is here this.lastRow is nullAfter few reloads and manual date change calendar seem to work fine for a while, but it can stop at anytime. There are no errors in Tomcat logs (we are using Tomcat 5.5, but we have same error with Glassfish 2).
    Here is JSP code:
    <ui:calendar binding="#{Index.startCalendar}" dateFormatPattern="dd.MM.yyyy" id="startCalendar" style="position: absolute; left: 120px; top: 96px"/>

    I had observed that the code for UI:Calendar Component looks up defaulttheme.jar file which will be avaialble with Sun studio creator or with UI tag jars ...... for its JS files, Images and style sheets etc .
    I tried seeing the contents in the JS files and there is a JS file specifically for Calendar Component ie calendar.js ... editing the same i came to see this
    // This does not work for August (08) and September (09) but it works
    // for all the other months????
    function ui_Calendar_setCurrentValue() {
        var curDate = this.field.value;
        var matches = true;
    but cant see Feb month there...
    It the problem with the code in teh JS file that they are using to generate the component...
    sooo the only solution would be to get the latest jars fixing that issue (defaulttheme.jar)
    I tried googling out for teh latest jars for the same i coudnt find any such...
    This is my investigation on this issue.Hope only code fix kills the flaw
    If any one gets a solution or workaround pls post ASAP to help us.+
    Edited by: Shivaji. on Feb 3, 2009 4:44 AM

  • Jsf datatable component + java.sql.SQLException

    I get the following error when implementing a JSF DataTable component using
    JDeveloper 10.1.3.1.
    javax.faces.FacesException: java.sql.SQLException: Io exception: Socket closed
    I am able to follow the article in this link:
    http://www.oracle.com/technology/oramag/oracle/06-jan/o16jsf.html
    I can get the table generated, but it occurred to me that the example in this article does not include logic to close the statement, resultset, and connection. Sure enough, I jumped out to the database and there were numerous inactive connections hanging around from my application.
    I added the following code before the return null statement from the article:
    finally {
    try {
    rs.close();
    stmt.close();
    c.close();
    catch (Exception e) {
    System.out.println("after close");
    So I need to know the proper procedure to closing the resultset, statement, and connection using a jsf datatable component.

    You need to make sure you're using the Oracle9i JDBC driver, or using the Oracle 8.1.7.2 JDBC driver as I mentioned above.
    If you are using JDeveloper9i release 9.0.2 or 9.0.3, the driver you need is in <jdevhome>\jdbc\lib
    Otherwise, you can also download the drivers from OTN.

  • Can't instantiate JSF Custom Component

    I'm hoping some of you expert (or at least seasoned) JSF custom component developers might be able to lend some insight into the "Can't instantiate class" problem. I have a custom component which extends another component (which happens to be Oracle ADF's panelGroup), and I've verified that everything is in place:
    1. Component class uses correct component type referenced by faces-config.xml and tag class
    2. Renderer type referenced in faces-config.xml matches that of the renderer type in component class
    3. There is a default constructor (no args) for the component class, which also sets the renderer type
    4. TLD with tag is correct
    All classes are definitely in the classpath, as I have another custom component in the same packages which loads and is used just fine.
    Any ideas would be appreciated.
    Thanks,
    Shawn Bertrand
    Tyco Electronics

    So, is no one else having any problems when using the new JSF components from Java Studio Creator 2 in their existing projects? I can make simple projects in Creator and run them on PointBase and Tomcat and can deploy and run from Eclipse using MyEclipse but I cannot get my existing project working and I am wondering if their is some sort of conflict between the new JSF components and legacy Struts stuff in that project or if perhaps Spring is someone interferering. Kind of at a loss right now...

  • Scroll for an af:iterator component

    Hi,
    I have an af:iterator into an af:menu component with the rows attribute set to -1. How can i display the af:iterator list into a scrollable component with a fixed height?
    By default the component displays all its items and introduces a vertical scroll to the page, not to the component itself.
    Thank you

    Hi,
    I want to keep my af:iterator component bound to an af:menu. If I introduce a panel group layout inside the af:menu and inside the panel group my af:iterator, when I press the menu component it is rendered firstly the panel group layout empty with the specific height and then the menu items from the af:iterator.
    Thanks.

  • Tooltip on the header of JSF table Component

    How to add an Tooltip to the header of the JSF table copmponent?
    Please reply....

    You normally use the HTML 'title' attribute for this. Almost every JSF HTML component also supports it.

  • JSF - UICommand component not rendering properly

    2:12 PM 7/11/2007
    by Nirav Assar
    Overview
    It was discovered that in certain situations a UICommand component does not bind properly to its associated action method in the managed bean. The symptoms of this situation occur when you have a page with an action, and you click the action and nothing occurs. The page seems like it submits, but no code inside the action method of the managed bean gets executed and no errors are generated in the console!
    Problem
    The problem arises when you have a managed bean in request scope and you have a UICommand, either a commandLink or commandButton, associated to the bean. In addition this UICommand component has a rendered attribute tag (boolean value) that uses a managed bean method to tell it whether is renders or not. Even if the component gets rendered to the screen, the component does not get binded to the action method in the request scoped bean. This is a problem with JSF and may be due to the fact that the component gets rendered, but since the bean is not created until a request is submitted, the component never gets binded to an action. Therefore, nothing in the action method ever gets executed.
    Analysis
    Thus is seems like if you want to dynamically render a submit type component, such as a button or a link, you cannot effectivley do that with a bean in request scope. You'll have to place it session scope, which will work fine. Another option is to render the buttons all the time, but based on some scenario, using the "disabled" attribute to prevent a user from using the action. The "disable" attribute can access a boolean method in the managed bean.
    You could also use Javascript to hide the already rendered button on certain circumstance. However this would require javascript knowing the state of the domain objects/and or managed bean state.
    References:
    http://forum.java.sun.com/thread.jspa?threadID=5127437&messageID=9461810

    RamondDeCampo hit the nail on the head. If the bean used for the rendered attribute is request scope and the value differs between requests, you're going to see this type of behavior.
    Search the forums, there have been many similar reports as well as suggested solutions.

  • JSF + Tomahawk component NullPointerException

    Hi All,
    I made a sun JSF portlet by using the tomahawk 1.1.3 file upload component. The bean "UploadedFile myFile" is not getting set in the "MyBean.java" file. I get a java.lang.NullPointerException when I am trying to myFile.getName() or myFile.getInputStream().
    The inputFileUpload method should set the myFile Bean but it seems like its not getting set
    1
    2 <t:inputFileUpload id="myFileId"
    3            value="#{myBean.myFile}"
    4 storage="file"
    5 required="true"/>
    6 <h:message for="myFileId"/>
    I am attaching the whole code below
    Can somebody please help me. I have tried various versions of tomahawk and still not able to figure out the problem.
    I am using JSF 1.1.0 and tomahawk 1.1.3
    Please let me know if you need some more information from me
    1
      2======== index.jsp ==============
      3
      4<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      5<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      6<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
      7
      8<f:view>
      9
    10<h:form id="MyForm" enctype="multipart/form-data" >
    11
    12    <h:messages globalOnly="true" styleClass="message"/>
    13
    14    <h:panelGrid columns="3" border="0" cellspacing="5">
    15
    16        <h:outputLabel for="myFileId" value="File: "/>
    17        <t:inputFileUpload id="myFileId"
    18            value="#{myBean.myFile}"
    19            storage="file"
    20            required="true"/>
    21        <h:message for="myFileId"/>
    22
    23        <h:outputLabel for="myParamId" value="Param: "/>
    24        <h:selectOneMenu id="myParamId"
    25                value="#{myBean.myParam}"
    26                required="true">
    27            <f:selectItem itemLabel="" itemValue=""/>
    28            <f:selectItem itemLabel="MD5" itemValue="MD5"/>
    29            <f:selectItem itemLabel="SHA-1" itemValue="SHA-1"/>
    30            <f:selectItem itemLabel="SHA-256" itemValue="SHA-256"/>
    31            <f:selectItem itemLabel="SHA-384" itemValue="SHA-384"/>
    32            <f:selectItem itemLabel="SHA-512" itemValue="SHA-512"/>
    33        </h:selectOneMenu>
    34        <h:message for="myParamId"/>
    35
    36        <h:outputText value=" "/>
    37        <h:commandButton value="Submit"
    38            action="#{myBean.processMyFile}"/>
    39        <h:outputText value=" "/>
    40
    41    </h:panelGrid>
    42
    43</h:form>
    44
    45</f:view>
    46
    47
    48==========  MyBean.java ==============
    49
    50<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    51<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    52<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
    53
    54<f:view>
    55
    56<h:form id="MyForm" enctype="multipart/form-data" >
    57
    58    <h:messages globalOnly="true" styleClass="message"/>
    59
    60    <h:panelGrid columns="3" border="0" cellspacing="5">
    61
    62        <h:outputLabel for="myFileId" value="File: "/>
    63        <t:inputFileUpload id="myFileId"
    64            value="#{myBean.myFile}"
    65            storage="file"
    66            required="true"/>
    67        <h:message for="myFileId"/>
    68
    69        <h:outputLabel for="myParamId" value="Param: "/>
    70        <h:selectOneMenu id="myParamId"
    71                value="#{myBean.myParam}"
    72                required="true">
    73            <f:selectItem itemLabel="" itemValue=""/>
    74            <f:selectItem itemLabel="MD5" itemValue="MD5"/>
    75            <f:selectItem itemLabel="SHA-1" itemValue="SHA-1"/>
    76            <f:selectItem itemLabel="SHA-256" itemValue="SHA-256"/>
    77            <f:selectItem itemLabel="SHA-384" itemValue="SHA-384"/>
    78            <f:selectItem itemLabel="SHA-512" itemValue="SHA-512"/>
    79        </h:selectOneMenu>
    80        <h:message for="myParamId"/>
    81
    82        <h:outputText value=" "/>
    83        <h:commandButton value="Submit"
    84            action="#{myBean.processMyFile}"/>
    85        <h:outputText value=" "/>
    86
    87    </h:panelGrid>
    88
    89</h:form>
    90
    91</f:view>
    92
    93
    94=========== faces-config.xml ==========
    95
    96<?xml version="1.0"?>
    97<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    98
    99<faces-config xmlns="http://java.sun.com/JSF/Configuration">
    100    <managed-bean>
    101        <managed-bean-name>user</managed-bean-name>
    102        <managed-bean-class>com.sample.jsfsun.bean.UserBean</managed-bean-class>
    103        <managed-bean-scope>session</managed-bean-scope>
    104    </managed-bean>
    105    <managed-bean>
    106        <managed-bean-name>myBean</managed-bean-name>
    107        <managed-bean-class>com.sample.jsfsun.bean.MyBean</managed-bean-class>
    108        <managed-bean-scope>request</managed-bean-scope>
    109    </managed-bean>
    110    <navigation-rule>
    111        <from-view-id>/index.jsp</from-view-id>
    112        <navigation-case>
    113            <from-outcome>submit</from-outcome>
    114            <to-view-id>/welcome.jsp</to-view-id>
    115        </navigation-case>
    116    </navigation-rule>
    117    <navigation-rule>
    118        <from-view-id>/welcome.jsp</from-view-id>
    119        <navigation-case>
    120            <from-outcome>back</from-outcome>
    121            <to-view-id>/index.jsp</to-view-id>
    122        </navigation-case>
    123    </navigation-rule>
    124</faces-config>
    125
    126============= web.xml =============
    127
    128
    129<?xml version="1.0"?>
    130<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    131
    132<web-app>
    133    <display-name>friend_info_portlet</display-name>
    134    <context-param>
    135        <param-name>company_id</param-name>
    136        <param-value>liferay.com</param-value>
    137    </context-param>
    138    <context-param>
    139        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    140        <param-value>client</param-value>
    141    </context-param>
    142    <context-param>
    143        <param-name>javax.faces.application.CONFIG_FILES</param-name>
    144        <param-value>/WEB-INF/faces-config.xml</param-value>
    145    </context-param>
    146    <context-param>
    147        <param-name>com.sun.faces.validateXml</param-name>
    148        <param-value>false</param-value>
    149    </context-param>
    150    <filter>
    151        <filter-name>ExtensionsFilter</filter-name>
    152        <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
    153        <init-param>
    154            <param-name>uploadMaxFileSize</param-name>
    155            <param-value>10m</param-value>
    156        </init-param>
    157        <init-param>
    158            <param-name>uploadThresholdSize</param-name>
    159            <param-value>100k</param-value>
    160        </init-param>
    161    </filter>
    162    <filter-mapping>
    163        <filter-name>ExtensionsFilter</filter-name>
    164        <servlet-name>Faces Servlet</servlet-name>
    165    </filter-mapping>
    166    <filter-mapping>
    167        <filter-name>ExtensionsFilter</filter-name>
    168        <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
    169    </filter-mapping>
    170    <filter-mapping>
    171        <filter-name>ExtensionsFilter</filter-name>
    172        <url-pattern>*.jsf</url-pattern>
    173    </filter-mapping>
    174    <listener>
    175        <listener-class>com.liferay.portal.kernel.servlet.PortletContextListener</listener-class>
    176    </listener>
    177    <listener>
    178        <listener-class>com.liferay.util.jsf.sun.faces.config.LiferayConfigureListener</listener-class>
    179    </listener>
    180    <servlet>
    181        <servlet-name>friend_info_portlet</servlet-name>
    182        <servlet-class>com.liferay.portal.kernel.servlet.PortletServlet</servlet-class>
    183        <init-param>
    184            <param-name>portlet-class</param-name>
    185            <param-value>com.sun.faces.portlet.FacesPortlet</param-value>
    186        </init-param>
    187        <load-on-startup>0</load-on-startup>
    188    </servlet>
    189    <servlet>
    190        <servlet-name>Faces Servlet</servlet-name>
    191        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    192        <load-on-startup>1</load-on-startup>
    193    </servlet>
    194    <servlet-mapping>
    195        <servlet-name>friend_info_portlet</servlet-name>
    196        <url-pattern>/friend_info_portlet/*</url-pattern>
    197    </servlet-mapping>
    198    <servlet-mapping>
    199        <servlet-name>Faces Servlet</servlet-name>
    200        <url-pattern>/faces/*</url-pattern>
    201    </servlet-mapping>
    202    <servlet-mapping>
    203        <servlet-name>Faces Servlet</servlet-name>
    204        <url-pattern>*.faces</url-pattern>
    205    </servlet-mapping>
    206    <welcome-file-list>
    207        <welcome-file>index.jsp</welcome-file>
    208    </welcome-file-list>
    209    <taglib>
    210        <taglib-uri>http://java.sun.com/portlet</taglib-uri>
    211        <taglib-location>/WEB-INF/tld/liferay-portlet.tld</taglib-location>
    212    </taglib>
    213</web-app>

    jabalsad wrote:
    contents of /WEB-INF/lib
    jsf-api.jar
    jsf-impl.jar
    myfaces-api-1.2.7.jar
    myfaces-impl-1.2.7.jar
    You cannot mix differnet JSF implementations. Use the one or the other.
    As you stated that you're "using" Mojarra, get rid of those myfaces jars.

  • Problem in JSF addRemoveList component selection

    Hi,
    We are using JSF creator studio 2.0. In our project we are using addRemoveList component to display available and selected items.
    We are able to display the selected value from available list to Selected list.
    uisng Add and remove buttons of the AddremoveList component.
    But we are facing the problem is, we are unable to get particular selected or highlighted value from the SelectedList .
    However we are able to get all selected items in bakingBean.
    This is very very important for us to move further in our development. I really appreciate for any sort of help.
    Thanks,
    Ramesh

    Hey Andy,
    I did it that way (JSC 2):
    assuming the add remove component's id is arl and that the components' item-property is bound to a datatable (mysql). The value field is of type Long, the display field is of type String.
    Get selected:
    get an array of selected objects directly from the component, and then do what ever you like to with that array.
    Object[] objSel = (Object[]) arl.getSelected();
    int i;
    int l = objSel.length;
    String str;
    for (i = 0; i < l ; i++) {
    str = objSel.toString();
    Set selected:
    Just create an array of objects holding the selected values and pass it to the component. But, attention, you'll need to make sure you're feeding the object array with the correct types of values. In my sample the value is a Long as described above, so I also need to pass in a Long, else the component just does nothing at all.
    Object[] selObj = new Object[] {new Long(5), new Long(8)};
    arl.setSelected(selObj);
    I found this the most easy option to get and set the add remove list selection.
    An other quite easy option is to bind the selected-property of the component to any session-bean property of type object-array and then set this sessionbean-property to the approrpiate values. But here you need also to make sure the datatype is correct.

Maybe you are looking for

  • Excise Duty - Standard Cost Estimate

    Hi Experts, We have defined Excise duty as one of the cost component in the cost component structure.  Can some one explain how this Excise duty is posted as planned values in the Standard Cost Estimate ( For material cost quantity from the BOM and p

  • Outlook 2013 Won't Display My Archived Mail PST Files

    Hi there, I have recently upgraded to Outlook 2013 from 2010. I have archived mail in PST files going back many years. I managed to open the first one I tried (Outlook 2003 archive) but noticed it wouldn't display sent items on a common search. I the

  • How can I Create return order with reference to an ARCHIVED invoice

    The standard "Reference" process does not work when the invoice has been archived. Has anyone solved this problem?

  • Re: The Forte Stopwatch

    We had a similar problem. We reported the problem to Forte technical support and they determined that it is a bug. I don't know if this has been fixed in the 3.0.F release. The Stopwatch seems to be accurate for long (several second) intervals, but i

  • Please Help me with this crash

    can anybody help me with this crash: Host Name: matt-guerins-powerbook-g4-15 Date/Time: 2008-04-08 10:04:27.426 -0400 OS Version: 10.4.11 (Build 8S165) Report Version: 4 Command: iCal Path: /Users/mattguerin/Library/Application Support/iCal/iCal.app/