Af:forEach statement causing other jsf components to be repeated

Hi,
I am experiencing the same problems as recorded in the following log:
JSF af:forEach is looping also tags outside of af:forEach
I have replaced my af:forEach tag with af:iterator which works with the number of items coming back changing dynamically (and therefore does not cause the display issues), however I can't display the iterator results in the same way as for the forEach loop.
I am trying to get the iterator output displayed in a 3 by 3 grid, but the panel grid does not seem to recognise the iterator output as separate cells but just one continual line.
Does anyone have any ideas as to how I can achieve the above?
Thanks,
Dave

Hi Frank,
Thanks so much for replying.
The code that is causing me problems is as follows:
<h:panelGrid width="335" columns="3">
<af:forEach var="row" items="#{bindings.WsWanalItemsView1.rangeSet}">
<af:panelGroup layout="vertical">
<af:commandLink action="#{backing_catalogue.selectProduct_action}">
<af:objectImage
source="http://#{res[\'filehandling.ip_address\']}/FileHandling/imageScale
?entity=STY&type=THUMB&image=#{row.Stycode}&pic=thumb&X=100&Y=100
&subtype=NONE&subentity=NONE"
height="137" width="104"/>
<af:setActionListener from="#{row.Stycode}"
to="#{processScope.ParamStyCode}"/>
<af:setActionListener from='#{\"NONE\"}'
to="#{processScope.ParamSubEntityType}"/>
<af:setActionListener from='#{\"NONE\"}'
to="#{processScope.ParamSubEntity}"/>
</af:commandLink>
<af:panelHorizontal>
<af:commandLink text="#{row.Thumbcomment}"
inlineStyle="font-size:9.0pt;"
action="#{backing_catalogue.selectProduct_action}">
<af:setActionListener from="#{row.Stycode}"
to="#{processScope.ParamStyCode}"/>
<af:setActionListener from='#{\"NONE\"}'
to="#{processScope.ParamSubEntityType}"/>
<af:setActionListener from='#{\"NONE\"}'
to="#{processScope.ParamSubEntity}"/>
</af:commandLink>
<af:objectSpacer width="1" height="16"/>
</af:panelHorizontal>
</af:panelGroup>
</af:forEach>
</h:panelGrid>
The forEach statement is bound to a table that brings back product Id's (9 at a time), which are then put into the source url for an object image to display the relevant image. There is also a caption hyperlink displayed underneath the image.
The forEach statement is placed in a panelGrid so that the images are displayed as a 3x3 grid.
The image itself is a link that when selected runs code that executes a query, displaying information related to the selected image.
This all works really well, however if I select an image and display its details, then change another parameter on the page that means different product ids are returned, then select to see details for another image then multiple JSF components on the screen (they all seem to come after the forEach statement) are displayed twice.
After much digging I found the following statements:
"changes from one request to the next. It may be possible to work around this in some scenarios by manually deleting all the children of the parent component (e.g., af:selectOneListbox in the code sample below), but this has not yet been tested. "
and
"Unlike the af:forEach tag, the af:iterator tag implements an iteration that works with a JSF DataModel or CollectionModel, and can be bound to EL expressions that use EL variables created by components."
Therefore I have tried to use an af:iterator instead. By changing my af:forEach for an af:iterator I no longer get the duplication issues mentioned above, but I'm having trouble displaying the output of the iterator in a panel grid. I.e. 3x3 images each with a label underneath. It's as if it treats the output of the iterator as a single component.
This is causing me serious problems so your help on this issue would be greatly appreciated.
Thanks,
Dave

Similar Messages

  • Integration of other JSF Components

    Has anyone had success importing the OurFaces components into Creator?
    Is there an established best approach on how to add custom components to Creator? I know the JSF spec needs to be enhanced in this area but I am in the process of implementing several custom components and want to ensure they will be integratable (sp?) into Creator.
    Thanks a bunch!
    Ernie :)

    Helo Ernie,
    I wouldnt say I had success in importing OurFaces components into Creator but I was able to import the components and see a list of the OurFaces components in the Palette. Here is what I did :
    In the palette -> added components I right clicked and chose Import components. In the component runtime jar I browsed and chose the ourfaces.jar located in the D:\OurFaces\ourfaces\webapps\ourfaces\WEB-INF\lib directory. I chose the same ourfaces.jar for the Tool design time jar also. I clicked ok and I could see the list of components. I am not sure of how correct this is because when I drag and drop any of the components I cant see them on the form but they appear under Page1 -> html of the application outline window. I am not sure if anything has to be entered for Default tag library prefix and Default tag library URI. Since I have not really worked with OurFaces components I think I am missing out something here. I hope someone will be able to take it from here and get it working.
    Cheers :-)

  • How can I validate a DataTable with inputText and other JSF components?

    I have a DataTable with various input components. I need to be able to validate what the user has entered on all the rows of the DataTable. Does anyone have any examples they can point me to, experiences with this, or knowledge on how to do this?
    Thank you so much.

    Do you have to use backing beans instead of managed beans to validate components inside a DataTable?

  • JSP 2.0 tag files for rendering JSF components

    Over the weekend I read up on new JSP 2.0 features (dunno why I waited this long??) ... I really liked the tag file feature ...
    I was wondering if it were a good idea to use these tag files as renderers for JSF components - ok, this ties us to a JSP only solution but how many in here would be using a non-JSP solution anyway?
    I was thinking along the foll. lines:
    <myComponent id="myComponent1" attr1="value1" attr2=value2">
        <myComponentRenderer var="myComponent1" />
    </myComponent>
    myComponentRenderer can be implemented as a tag file in myComponentRenderer.tag ... The myComponent tag delegates the business logic processing to its associated UIComponent and then sets this component as a pageContext attribute with the id "myComponent1" ... myComponentRenderer in turn gets a reference to this UIComponent and renders it ...
    Again, if one wants a different way of rendering, make another tag file myComponentRenderer2.tag or change myComponentRenderer.tag itself ...
    Indeed, this may not work for components with complicated rendering logic but I believe that's only the 20% case ...
    Comments?
    P.S.:
    I've picked this up from http://forums.java.sun.com/thread.jsp?forum=427&thread=381052&tstart=0&trange=15
    This also compliments another topic: http://forums.java.sun.com/thread.jsp?forum=427&thread=413515&tstart=0&trange=15

    You are right in saying that decoding has nothing to
    do with rendering per se.I will go even further than Erik did, and dispute this statement.
    Consider that you are generating an <input> tag for a text field. Among other things, you have to generate a "name" attribute. Who decides what to put there? The renderer that actually created the markup.
    The "renderer" really does
    two completely different things. But both should
    nevertheless be separate from the component
    implementation itself. You could still have the
    renderer doing the decoding part, which arguably would
    rarely change, and somehow delegate the actual
    rendering to an implementation in a tag file.Whether you implement decoding in a separate class or inside the component, what request parameter name do you look for? It is not reasonable to assume that ALL possible renderers will choose the same parameter name ... hence, decoding and encoding are inextricably linked (the code doing the decoding has to know what kind of markup the code doing the encoding actually created). In JavaServer Faces, the current APIs create that linkage by requiring that the decode and encode be done by the same class (either the component, if you are not delegating, or the renderer if you are).
    Craig

  • Nesting/Nested JSF components

    Please excuse what should be a rudimentary question, but I can't seem to find any documentation on how to nest JSF components.
    For example, given the following objects:
    public class Order {
       private Address deliveryAddress;
       private Address billingAddress;
       //getters and setters...
    public class Address
        private String street;
        private String city;
        //getters and setters...
    }and the jsf managed beans:
    public class OrderModel {
        private Order order;
        // getters/setters and  jsf state, handlers, etc ...
    public class AddressModel {
       private Address address;
       // getters/setters and jsf state, handlers, etc ...
    }with faces-config.xml:
        <managed-bean>
            <managed-bean-name>orderModel</managed-bean-name>
            <managed-bean-class>OrderModel</managed-bean-class>
            <managed-bean-scope>session</managed-bean-scope>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>addressModel</managed-bean-name>
            <managed-bean-class>AddressModel</managed-bean-class>
            <managed-bean-scope>session</managed-bean-scope>
        </managed-bean>
    ...So, my question is, how can I go about writing a reusable order and address component so I can call nest the address component within my order template?
    I guess I'm looking for something like (just a guess - not actual working code):
    order-template.jspx:
    <f:view xmlns:h="http://java.sun.com/jsf/html"
            xmlns:f="http://java.sun.com/jsf/core"
            xmlns:ui="http://java.sun.com/jsf/facelets">
    Delivery Address:<br/>
        <ui:decorate template="address-template.jspx">
    <!-- can I pass in #{orderModel.order.deliveryAddress} here? -->
        </ui:decorate>
    Billing Address:<br/>
        <ui:decorate template="address-template.jspx">
    <!-- can I pass in #{orderModel.order.billingAddress} here? or use something other than ui:decorate? -->
        </ui:decorate>
    </f:view>
    address-template.jspx:
    <f:view xmlns:h="http://java.sun.com/jsf/html"
            xmlns:f="http://java.sun.com/jsf/core"
            xmlns:ui="http://java.sun.com/jsf/facelets">
    street:<h:inputText value="#{addressModel.address.street}" />
    city:<h:inputText value="#{addressModel.address.city}"  valueChangeListener="#{addressModel.onCityChanged}"/>
    </f:view>I'm guessing the solution lies in having the OrderModel contain an AddressModel for the delivery and billing address, then pass #{orderModel.deliveryAddressModel} and #{orderModel.billingAddressModel} into the address template.
    So really my question is simply how do I pass those objects into the address-template.jspx?
    Many many thanks in advance!

    You want to use <ui:include> instead of <ui:decorate>. E.g.
    Delivery Address:<br/>
    <ui:include src="/WEB-INF/includes/address-template.jspx">
        <ui:param name="address" value="#{orderModel.order.deliveryAddress}" />
    </ui:include>
    Billing Address:<br/>
    <ui:include src="/WEB-INF/includes/address-template.jspx">
        <ui:param name="address" value="#{orderModel.order.billingAddress}" />
    </ui:include>Then you can refer to #{address} within address-template.jspx.
    Be aware however that Facelets is not particularly careful about protecting namespaces with includes and such. This won't be a problem if you use a unique name for the parameter.

  • How to refresh/restore VIEW STATE of a JSF component?   urgent help needed!

    AOA guys,
    I am using Jboss 4.0.5, JSF 1.1.2 and DOJO framework to handle ajax request.
    In my project, I am using A4J hidden fields to store values associated with an html anchor tag and use these values to update <h:outputText> dynamically (an ajax request).
    But when i click that anchor link a more than 15 times the message appears as a prompt that view state couldn't be restored - reload page.
    I think it is because that in JSF 1.1 default value of
    om.sun.faces.NUMBER_OF_VIEWS_IN_LOGICAL_VIEW_IN_SESSION is 15, So i can't store more than 15 View Id of JSF components.
    My Question is:
    _Without shifting to JSF1.2, how can i handle this restore view problem in my Java Code using phase listener or some other way so that if this view state problem will occur it atomatically restore the view ids?_
    Please reply me soon?

    avoid multi post
    http://forum.java.sun.com/thread.jspa?threadID=5229804

  • NotSerializable exception from JSF components

    Hi All
    I have a JSF application deployed in WAS in a clustered environment,
    The problem is , in clustered environment the session manager tries to write the session object , so that if one machine goes down the other can pick it up, now i get an Exception that the JSF components are not serializable. i dont know why is this happening.
    below is the Stack trace
    6/7/07 11:07:10:721 EDT] 000000ee SessionContex E Exception is: java.io.NotSerializableException: javax.faces.component.html.HtmlSelectManyListbox
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
    at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java(Compiled Code))
    at com.ibm.ws.webcontainer.httpsession.BackedHashtableMR.handlePropertyHits(BackedHashtableMR.java(Compiled Code))
    at com.ibm.ws.webcontainer.httpsession.BackedHashtable.persistSession(BackedHashtable.java:2307)
    at com.ibm.ws.webcontainer.httpsession.BackedHashtable.ejbStore(BackedHashtable.java:2501)
    at com.ibm.ws.webcontainer.httpsession.BackedHashtable.storeSession(BackedHashtable.java:2143)
    at com.ibm.ws.webcontainer.httpsession.BackedHashtable.put(BackedHashtable.java:2776)
    at com.ibm.ws.webcontainer.httpsession.DatabaseSessionContext.sync(DatabaseSessionContext.java:164)
    at com.ibm.ws.webcontainer.httpsession.SessionData.releaseSession(SessionData.java:289)
    at com.ibm.ws.webcontainer.httpsession.SessionContext.sessionPostInvoke(SessionContext.java:2860)
    at com.ibm.ws.webcontainer.srt.SRTRequestContext.finish(SRTRequestContext.java(Compiled Code))
    at com.ibm.ws.webcontainer.srt.SRTServletRequest.finish(SRTServletRequest.java:1359)
    at com.ibm.ws.webcontainer.srt.SRTConnectionContext.finishConnection(SRTConnectionContext.java:75)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:2041)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:89)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:472)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:411)
    at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:101)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java(Compiled Code))
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java(Compiled Code))
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java(Compiled Code))
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java(Compiled Code))
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
    Any help is appreciated a lot...
    Thanks in advance

    I'm guessing that you have a session level backing bean that has a property that is bound to an HtmlSelectManyListbox instance via the binding attribute.
    You can address this in the following ways: 1) make the bean request scope; 2) make the property transient in the bean or 3) remove the binding. My first instinct would be 1), while 2) sounds quick and easy I suspect it will cause problems. 3) obviously requires some rewriting.

  • Can I write Design-time for JSP custom tag(not JSF components)

    I have some old JSP custom tags(not JSF components), and I want to use them in the IDE through the toolbox.
    Now I have already written the BeanInfos for these tags, and they can be drag from the toolbox; but it will throw a Exception when render the tags, and the properties in the Property Editor are not which I describe in the BeanInfos.
    How can I write Design-time for these tags? or whether it is possible to write the Design-time for these tags?
    the Exception is shown as follow:
    java.lang.ClassCastException
         at com.sun.rave.insync.faces.FacesPageUnit.renderNode(FacesPageUnit.java:1347)
    [catch] at com.sun.rave.insync.faces.FacesPageUnit.renderBean(FacesPageUnit.java:1086)
         at com.sun.rave.insync.faces.FacesPageUnit.getFacesRenderTree(FacesPageUnit.java:993)
         at com.sun.rave.css2.FacesSupport.getFacesHtml(FacesSupport.java:152)
         at com.sun.rave.css2.CssContainerBox.addNode(CssContainerBox.java:373)
         at com.sun.rave.css2.CssContainerBox.createChildren(CssContainerBox.java:354)
         at com.sun.rave.css2.DocumentBox.createChildren(DocumentBox.java:90)
         at com.sun.rave.css2.DocumentBox.relayout(DocumentBox.java:160)
         at com.sun.rave.css2.PageBox.layout(PageBox.java:392)
         at com.sun.rave.css2.PageBox.relayout(PageBox.java:454)
         at com.sun.rave.css2.DocumentBox.redoLayout(DocumentBox.java:313)
         at com.sun.rave.css2.PageBox.redoLayout(PageBox.java:460)
         at com.sun.rave.css2.DocumentBox.changed(DocumentBox.java:634)
         at com.sun.rave.designer.DesignerPaneUI$UpdateHandler.changedUpdate(DesignerPaneUI.java:1012)
         at com.sun.rave.text.Document.fireChangedUpdate(Document.java:851)
         at com.sun.rave.text.Document$5.run(Document.java:631)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

    I have some old JSP custom tags(not JSF components), and I want to use them in the IDE through the toolbox.
    Now I have already written the BeanInfos for these tags, and they can be drag from the toolbox; but it will throw a Exception when render the tags, and the properties in the Property Editor are not which I describe in the BeanInfos.
    How can I write Design-time for these tags? or whether it is possible to write the Design-time for these tags?
    the Exception is shown as follow:
    java.lang.ClassCastException
         at com.sun.rave.insync.faces.FacesPageUnit.renderNode(FacesPageUnit.java:1347)
    [catch] at com.sun.rave.insync.faces.FacesPageUnit.renderBean(FacesPageUnit.java:1086)
         at com.sun.rave.insync.faces.FacesPageUnit.getFacesRenderTree(FacesPageUnit.java:993)
         at com.sun.rave.css2.FacesSupport.getFacesHtml(FacesSupport.java:152)
         at com.sun.rave.css2.CssContainerBox.addNode(CssContainerBox.java:373)
         at com.sun.rave.css2.CssContainerBox.createChildren(CssContainerBox.java:354)
         at com.sun.rave.css2.DocumentBox.createChildren(DocumentBox.java:90)
         at com.sun.rave.css2.DocumentBox.relayout(DocumentBox.java:160)
         at com.sun.rave.css2.PageBox.layout(PageBox.java:392)
         at com.sun.rave.css2.PageBox.relayout(PageBox.java:454)
         at com.sun.rave.css2.DocumentBox.redoLayout(DocumentBox.java:313)
         at com.sun.rave.css2.PageBox.redoLayout(PageBox.java:460)
         at com.sun.rave.css2.DocumentBox.changed(DocumentBox.java:634)
         at com.sun.rave.designer.DesignerPaneUI$UpdateHandler.changedUpdate(DesignerPaneUI.java:1012)
         at com.sun.rave.text.Document.fireChangedUpdate(Document.java:851)
         at com.sun.rave.text.Document$5.run(Document.java:631)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

  • How to standardize the look & feel of different vendor JSF components?

    Hi,
    There are various JSF components created by different parties. For example, Tomahawk from Myfaces, ADF faces from Oracle, SUN components that provided in Java Studio creator. They look different.
    Can we standard the look and feel for these various components when we use them in a same project? so that it wouldn't look that different when the page is displayed to the end user.
    Please advise.
    Thank you.

    Hi,
    Can you be more specific how to achieve that using css? You mean the look and fee that we see is not an image?
    Have you seen how Oracle ADF face look & feel is like?
    How to change its look to what we have SUN offered in its Java studio creator 2?
    Please advise.
    Thank you.

  • Problem Adding Custom JSF Components to Oracle JDeveloper 10g (10.1.3) Prev

    I'm having a problem on Adding Custom JSF Components to Oracle JDeveloper 10g (10.1.3) Preview (http://www.oracle.com/technology/products/jdev/101/collateral/101/adffaces/howto_customcomponents.html)
    The step 1 of 5 isn't visible for me and I don't see the "Install from local file" option to select the adf-faces-bundle.zip from my file system. The OTN check for updates don't prove the ADF Faces...
    What may I do?

    And...
    If "Check for Updates Wizard" is not launched, you can try to set LANG.
    see: 10.1.3 Can't not launch Update Wizard in Japanese environment.
    10.1.3 Can't not launch Update Wizard in Japanese environment.
    Thanks.
    Takuya Ono

  • How to select an "attribute" in a forEach statement?

    I'm a noob, so I appreciate the help! :)
    I'm trying to render text into a table from the node <country> where the attribute is equal to "uk"
    Here is my XML code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE lowest-fares [
         <!ELEMENT lowest-fares (country+)>
         <!ELEMENT country (fare+,rules)>
         <!ATTLIST country id ID #REQUIRED>
         <!ELEMENT fare (from,to,price)>
         <!ELEMENT from (#PCDATA)>
         <!ELEMENT to (#PCDATA)>
         <!ELEMENT price (#PCDATA)>
         <!ELEMENT codeshare (#PCDATA)>
    ]>
    <lowest-fares>
         <country id="uk">
              <fare>
                   <from>London</from>
                   <to>Los Angeles</to>
                   <price>900</price>
              </fare>
              <rules>Rules go here.</rule>
         </country>
    </lowest-fares>Here's my JSTL code in the page:
      <x:forEach select="$lowestFares//country">
          <tr>
            <td><x:out select="from"/></td>
            <td><x:out select="to"/></td>
            <td><x:out select="price"/></td>
          </tr>
          </x:forEach>I need to specify the "uk" attribute in the country element in the forEach statement, but I'm not sure the proper syntax required to add that in?

    Its standard xPath expression syntax: http://www.w3schools.com/xpath/xpath_syntax.asp
    Try select="$lowestFares//country[@id='uk']">
    I think that should select all countries where the id is 'uk'

  • Is JSF components changed in RAD 7.0?

    Hi,
    I see that some of the components like h:commandLink are missing in the RAD 7.0. Is that so?
    Also is there any documents which shows the usage of all the JSF components?
    Thanks,
    Elango

    Depends on the JSF implementation used in RAD. Consult the RAD manfacturer and its documentation.

  • ListView appearing behind other graphical components in VBox

    I have created a ListView implementation of a ChoiceBox since I have a very long list of items and I don't like the fact that the entire list is displayed when opening the ChoiceBox. I have attached this ListView to a button so that when a user clicks on the button the ListView opens just like a ChoiceBox. My issue, however, is that when the ListView is diplayed it appears behind the other graphical components in my VBox container! I have tried to call "toFront()" on my ListView component however the VBox repositions my ListView component to the bottom of the VBox (which makes sense since toFront merely moves the node to the end of the VBox node list). Obviously this is not the behaviour I want and I don't want to have to convert my VBox to a StackPane (or just a Pane) and layout the components myself since the VBox lays out the components perfectly. It would be nice if there were a "z order" parameter but that doesn't appear to be the case and I have already looked into the "depth" parameter.
    Are there any other ways to bring my ListView to the front without the VBox repositioning this component? How does the ChoiceBox component itself accomplish this? I have also tried to embed the ListView in a PopupControl but the unfortunate side effect of this is that the Popup always appears in front of EVERY window on my screen which is a tad annoying.
    BTW, I think JavaFX is the next best thing to sliced bread! I have written a very large application and this is the only issue that I have run into since it went GA. JavaFX has far exceeded my expectations and the JavaFX team (and Oracle in general) and other developers who have contributed to this project should all be commended for the outstanding work they have done on this!!!

    fermat wrote:
    I have created a ListView implementation of a ChoiceBox since I have a very long list of items and I don't like the fact that the entire list is displayed when opening the ChoiceBox. I have attached this ListView to a button so that when a user clicks on the button the ListView opens just like a ChoiceBox. My issue, however, is that when the ListView is diplayed it appears behind the other graphical components in my VBox container! I have tried to call "toFront()" on my ListView component however the VBox repositions my ListView component to the bottom of the VBox (which makes sense since toFront merely moves the node to the end of the VBox node list). Obviously this is not the behaviour I want and I don't want to have to convert my VBox to a StackPane (or just a Pane) and layout the components myself since the VBox lays out the components perfectly. It would be nice if there were a "z order" parameter but that doesn't appear to be the case and I have already looked into the "depth" parameter.
    Are there any other ways to bring my ListView to the front without the VBox repositioning this component? How does the ChoiceBox component itself accomplish this? I have also tried to embed the ListView in a PopupControl but the unfortunate side effect of this is that the Popup always appears in front of EVERY window on my screen which is a tad annoying.Ya, the PopupControl is the way to go with this. The reason why is that if you use "lightweight" rendering of the drop down (er... popup?) and it extends beyond the end of the window, you will have your list appear clipped. So you have to use a real heavyweight window (the PopupControl) to make sure that if it extends beyond the edge of the window, it displays correctly.
    I believe the UI controls team is planning on adding a proper ComboBox (which, FWIW, we always planned to add) sometime between now and 3.0, but I'm not sure when. The ChoiceBox actually uses a ContextMenu, while ComboBox would use PopupControl, but some of the little details are the same. Here is a code snippet that might be useful from the ChoiceBox skin.
            // When popup is hidden by autohide - the ChoiceBox Showing property needs
            // to be updated. So we listen to when autohide happens. Calling hide()
            // there after causes Showing to be set to false
            popup.setOnAutoHide(new EventHandler<Event>() {
                @Override public void handle(Event event) {
                    ((ChoiceBox)getSkinnable()).hide();
            // fix RT-14469 : When tab shifts ChoiceBox focus to another control,
            // its popup should hide.
            getSkinnable().focusedProperty().addListener(new ChangeListener<Boolean>() {
                @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
                    if (!newValue) {
                        ((ChoiceBox)getSkinnable()).hide();
            // TODO remove this id once bug RT-7542 is fixed.
            popup.setId("choice-box-popup-menu");
    BTW, I think JavaFX is the next best thing to sliced bread! I have written a very large application and this is the only issue that I have run into since it went GA. JavaFX has far exceeded my expectations and the JavaFX team (and Oracle in general) and other developers who have contributed to this project should all be commended for the outstanding work they have done on this!!!Dude, thanks for that, you just made my day :-)

  • JSF Components in HTML Components

    Hi,
    I'm trying to use JSF components as children of HTML components but the UI isn't being rendered properly.
    Basically, here's my scenario:
    <ul>
         <li>
              <h:commandLink id="newQuoteLink" styleClass="topNav" action="#{pc_HeaderFragment.newQuote}">
                   <h:outputText value="Add New Quote"/>                              
              </h:commandLink>               
         </li>
    </ul>All I want rendered is a text link ("Add New Quote") that will execute a backing bean method
    When I run the server, the <a> tag is generated before my original <ul> list.
    How come it can't simply return to the outputtext to the location that I called it?
    Am I missing something here?
    Thanks in advance!
    Matt

    Looks like you're using JSF 1.1. At this version of the spec, there were issues with content interweaving that necessitated the need
    of f:verbatim tags to wrap template text (i.e. non jsf-markup).
    This isn't necessary for 1.2, but if you must stick with 1.1, your markup should look something like:
    <f:verbatim>
    <ul>
        <li>
    </f:verbatim>
    <h:commandLink id="newQuoteLink" styleClass="topNav" action="#{pc_HeaderFragment.newQuote}">
        <h:outputText value="Add New Quote"/>                              
    </h:commandLink>            
    <f:verbatim>
         </li>
    </ul>
    </f:verbatim>Given the ugliness if this, if you have to use JSP for your views, migrate to JSF 1.2.
    If you must stay with 1.1, look into Facelets [1], Clay [2], or JSFTemplating [3]
    as a substitute for JSP as you won't have these issues.
    [1] https://facelets.dev.java.net
    [2] http://shale.apache.org
    [3] https://jsftemplating.dev.java.net

  • Binding JSF components and servlets to eachother

    Hi, I have some JSF components in my jsp page like this one:
    <h:form rendered="true" id="myForm">
                   <h:selectOneListbox>
                        <f:selectItem itemdisabled="false" itemlabel="item1" itemvalue="1"></f:selectItem>
                        <f:selectItem itemdisabled="false" itemlabel="item2" itemvalue="2"></f:selectItem>
                        <f:selectItem itemdisabled="false" itemlabel="item3" itemvalue="3"></f:selectItem>
                   </h:selectOneListbox>
              </h:form>and I have this servlet:
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class myServlet extends HttpServlet {
         public myServlet() {
              super();
         public void destroy() {
              super.destroy(); // Just puts "destroy" string in log
         public void doGet(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {
         public void doPost(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {
         public void init() throws ServletException {
    }Could you please help me:
    *1.* How to populate my listbox using my servlet?
    and also
    *2.* How to get the selected item in my servlet every time that user change the selected option of list box?

    Please don't crosspost topics over all places. Stick to one topic.
    Continue here: [http://forum.java.sun.com/thread.jspa?threadID=5299291]

Maybe you are looking for