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.

Similar Messages

  • 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 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 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 -Tomahawk Tabs

    I'm using JSF Tomahawk tabbedPane... to get the tabs... I have the commandbutton inside each t:panelTab whwn i click dat commandbutton, the action it is supposed to perform is done but it shows the first tab contents..
    for ex if i have commandbutton in second tab wen i click it performs correctly but first tab becomes active... i want dat particular tab to be active in which user has clicked commandbutton hw shall i do it...
    <t:panelTabbedPane id="editorPanel" >
    <t:panelTab id="tab11" label="Tab1" >
    <h:commandbutton action="" />
    </t:panelTab>
    <t:panelTab id="tab22" label="Tab2" >
    <h:commandbutton action="" />
    </t:panelTab>
    </t:paneltabbedPane>

    Thanks BalusC . Let me re iterate my question. I am new to JSF to pardon me if my terminology is not correct.
    I have a list which contains object .I have to generate tabs based on contents on list. So if list contain 3 objects I have to generate 3 tabs . Each page inside tab will have same layout but will be populated with different content.
    With that said. I used jsf pane_tab and I tried different ways to iterate over the list and include the jsp which will contain the layout. More specifically I tried something like below with different variations .
    <%
         for (int i = 0 ; i< list.size() ; i++)
              String abc = "name"+ i;
              %>
    <d:pane_tab id="<%= abc %>" >
    <f:facet name="label">
    <d:pane_tablabel label="test" commandName="third"/>
    </f:facet>
    <jsp:include page="addMaintenence.jsp"/>
    </d:pane_tab>
              <%
    %>
    It gives duplicate id error. Now I am not sure if my approach is right or not. Also if it not correct what should I try ??
    Any pointers would be helpful.
    Thanks in advance.
    Priyanka

  • 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...

  • 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.

  • Tomahawk DataScroller - NullPointerException with navigation panel

    Hi all,
    I'm trying to implement navigation on a dataTable with DataScroller. Except from the dataTable content the jsp is a copy / paste from the tomahawk cars example.
    My jsp structure has 3 main elements
    - datatable
    - scroller one for datatable navigation (next, previous, ...)
    - scroller two for datatable statistics (pages counts)
    When page is loaded there is a fatal error (NullPointerException)
    If I delete the scroller one definition in my jsp there is no error, data table is correctly populated with 10 first rows and scroller two information is correct.
    I tried with a simple ArrayList or with a DataModel in my backing bean. In both cases the NullPointerException happens.
    I checked web.xml, faces-config, ... can't find a reason.
    Any idea someone please? See stacktrace here under and sample of my jsp
    Thank you very much for any help.
    sunjavero
    // here is my jsp extract:
    <code>
    <f:view>
    <h:panelGroup id="body">
         <t:dataTAble id="data" ... >
         </t:dataTable>
         <h:panelGrid columns="1" ... >
              <t:dataScroller id="scroll_1" for="data" ... >
                   <f:facet name="first" >
                        <t:graphicImage url="images/arrow-first.gif" border="1" />
                   </f:facet>
                   // (other facets same principle...)
              </t:dataScroller>
              <t:dataScroller id="scroll_2" for="data" ... >
         <h:outputFormat ... >
                        <f:param value="#{rowsCount}" />
                        <f:param value="#{displayedRowsCountVar}" />
                        <f:param value="#{firstRowIndex}" />
                        <f:param value="#{lastRowIndex}" />
                        <f:param value="#{pageIndex}" />
                        <f:param value="#{pageCount}" />
                   </h:outputFormat>
              </t:dataScroller>
         </h:panelGrid>
    </h:panelGroup>
    </f:view>
    </code>
    exception:
    org.apache.jasper.JasperException: javax.servlet.jsp.JspException: null
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
    caused by (root error?):
    java.lang.NullPointerException
         com.sun.faces.renderkit.html_basic.CommandLinkRenderer.getHiddenFieldName(CommandLinkRenderer.java:136)
         com.sun.faces.renderkit.html_basic.CommandLinkRenderer.encodeEnd(CommandLinkRenderer.java:318)
         javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:720)
         org.apache.myfaces.custom.datascroller.HtmlDataScrollerRenderer.renderFacet(HtmlDataScrollerRenderer.java:294)
         org.apache.myfaces.custom.datascroller.HtmlDataScrollerRenderer.renderScroller(HtmlDataScrollerRenderer.java:236)
         org.apache.myfaces.custom.datascroller.HtmlDataScrollerRenderer.encodeEnd(HtmlDataScrollerRenderer.java:207)

    Hi all,
    I found out a solution (after many hours of cursing!): Better to enclose DataScroller inside a form.
    I don't understand why tomahawk example works fine without it (!!!)
    If someone has an explanation he is welcome
    And if someone explains me how to get more than 24 lines of stacktrace on windows 98 he is welcome too! (Unable to start tomcat from IDE because of wrong memory size), so have to start it from dos...
    Sincerely yours... tired sunjavero

  • 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>

  • JSF Tomahawk Dynamic Menu jsCookMenu Param Passing Question .. Help Please!

    Hello everyone,
    Thank you again for your help. Let me explain what my issue is.
    I am currently developing a JSF 1.2 application using WDSC 7 (RAD 7). I am trying to
    develop a shopping cart application. The part I am stuck on is the menu.
    I need to draw a menu with drop downs with multiple levels. The first level is the category
    and the second level is the item name. The menu must be dynamically built from a Database table.
    After searching high and low I came across jsCookMenu component which requires Tomahawk to be installed.
    I installed this ontop of my IBM JSF implementation and it seems to be working fine.
    I currently have a MenuBean which calls a database and populates a NavigationMenuItems array and passes
    that to the jsCookMenu component which then renders that to the client.
    This works fine.
    Here is my question. When the user selects the first level of the menu, I want to call a page called
    GetCategory.jsp?catID=num num being the category id selected. When they select the second level of the
    menu, I want it to then call GetItem.jsp?itemID=num. I know I can use the action attribute of the menu
    item or a direct URL (which pops it up in a new window).
    Basically, I need to pass a parameter to an action (again I am somewhat new to JSF) or I need
    to call the page directly passing the request parameter.
    Am I going about this the wrong way, and if so, what way should I be going?
    Secondly, is there a better, cleaner implementation or component I can use instead.
    I'm using Tomahawk just for the one component.. That's it.
    Any help anyone can provide I would greatly appreciate it.
    Thanks so much!
    Matt

    That is correct.
    I have the menu populating dynamically built from a JavaBean.
    It works beautifully.
    Level 1 is the Category - the action is DisplayCategory
    Level 2 is the Item - the action is DisplayItem
    Level 3 is the Style - the action is DisplayStyle
    My problem is, on each page, DisplayCategory/DisplayItem/etc how do I know which menu item was clicked?
    Anyone have any idea?
    Thanks,
    Matt

  • JSF custom component: value not binding to component

    I have a custom UIInput component which is not able to bind to the value of the component from a backing bean. Here is the JSF code snippet:
    <tw:validateInputText id="locationIdStopInput" table="location" column="location" styleClass="wideSingleInput" value="#{currentStop.customer.customer}" rendered="#{loadTypeView.renderWarehouse or (currentStop.stopNumber gt 1 and loadTypeView.renderOutbound) or (currentStop.stopNumber eq 1 and loadTypeView.renderInbound)}"/>
    tw is the custom tag and validateInputText is the custom UiInput component.
    On posting the form the decode method is not able to get the value from the requestParameter map. Following is the decode() I wrote:
    public void decode(FacesContext context,
    UIComponent component) {
    // assertValidInput(context, component);
    if (context == null || component == null) {
    throw new NullPointerException();
    ValidateInputTextComponent map = (ValidateInputTextComponent) component;
    String key = map.getId();
    if (component instanceof UIInput) {
    UIInput input = (UIInput) component;
    String clientId = input
    .getClientId(context);
    Map requestMap = context
    .getExternalContext()
    .getRequestParameterMap();
    String newValue = (String) requestMap
    .get(clientId);
    if (null != newValue) {
    input.setSubmittedValue(newValue);
    Also providing the setProperties() from the custom tag class:
    protected void setProperties(UIComponent component){
    super.setProperties(component);
    if (getValue()!=null){
    if (isValueReference(getValue())){
    ValueBinding vbTarget = FacesContext.getCurrentInstance().getApplication().
    createValueBinding(getValue());
    component.setValueBinding(VB_VALUE, vbTarget);
    System.out.println(component.getValueBinding("value").getValue(FacesContext.getCurrentInstance()));
    } else{
    ((UIInput) component).setValue(value);
    // component.getAttributes().put("value",getValue());
    if (getCompValue()!=null){
    if (isValueReference(getCompValue())){
    ValueBinding vbCompTarget = FacesContext.getCurrentInstance().getApplication().
    createValueBinding(getCompValue());
    component.setValueBinding(VB_COMPONENT_VALUE, vbCompTarget);
    } else{
    // ((UIInput) component).setValue(compValue);
    component.getAttributes().put(VB_COMPONENT_VALUE,getCompValue());
    if (getTable() != null && isValueReference(getTable())){
    ValueBinding vbTable = FacesContext.getCurrentInstance().getApplication().
    createValueBinding(getTable());
    component.setValueBinding(VB_TABLE, vbTable);
    } else{
    component.getAttributes().put(VB_TABLE, getTable());
    if (getColumn() != null && isValueReference(getColumn())){
    ValueBinding vbColumn = FacesContext.getCurrentInstance().getApplication().
    createValueBinding(getColumn());
    component.setValueBinding(VB_COLUMN, vbColumn);
    } else{
    component.getAttributes().put(VB_COLUMN,getColumn());
    if (getStyleClass() != null && isValueReference(getStyleClass())){
    ValueBinding vbClass = FacesContext.getCurrentInstance().getApplication().
    createValueBinding(getStyleClass());
    component.setValueBinding(VB_STYLE_CLASS, vbClass);
    } else{
    component.getAttributes().put(VB_STYLE_CLASS, getStyleClass());
    if(getRendered() != null && isValueReference(getRendered())){
    ValueBinding vbRendered = FacesContext.getCurrentInstance().getApplication().
    createValueBinding(getRendered());
    component.setValueBinding(VB_RENDERED, vbRendered);
    } else{
    Boolean a = new Boolean(getRendered());
    component.getAttributes().put(VB_RENDERED, new Boolean(getRendered()));
    Please let me know If I am missing something here to retrieve the value from the component.
    Thanks

    See this tutorial:
    http://www.jsftutorials.net/components/index.html

Maybe you are looking for

  • UPGRADE  Panther or Tiger on Imac DV 400?

    I am trying to determine which OS would be the better choice for my computer. I have been running 10.2.8 for a few years, but I just bought photoshop elements 4 and now I see I need 10.3 or better. I can use the educator discount from Apple for Tiger

  • Freezing Macbook Pro.

    Hi everyone!! I've had the same problem for months. My notebook is freezing a bit sometimes. It annoys me as **** and i've tried to figure out how i fix it but without any soulation. I've been reading about others with same symptomes and it seemes to

  • SRM 7.0 authorization objects for table maintenance

    Hi guys, I wanted to know how authorization objects work in SRM. I created a custom table which key filed is company code (BUKRS). And in the table maintenance view I have to add an authorization object based on the company code. Is it possible to do

  • Independent delivery numbers for each Inventory Organization.

    Hi. To all the community. We have an EBS instance with multiorg. We have 3 companies, and each company has its set of books, operating unit and inventory organization. Actually, the EBS is seeting up in a way that is giving a unique delivery number (

  • I am not able to access gmail. Error reading -The proxy server is refusing connections. Please help

    I get the attached error message when trying to access my gmail account "The proxy server is refusing connections. Firefox is configured to use a proxy server that is refusing connections. The problem started today. No issues before. Second problem a