wood burning stoves*
The moose likes JSF and the fly likes Why events are not fired when value changes in h:selectOneMenu? I am stuck! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Why events are not fired when value changes in h:selectOneMenu? I am stuck!" Watch "Why events are not fired when value changes in h:selectOneMenu? I am stuck!" New topic
Author

Why events are not fired when value changes in h:selectOneMenu? I am stuck!

bilal haider
Ranch Hand

Joined: Feb 08, 2011
Posts: 47

Contents of header.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">

<h:graphicImage alt="HeaderImage" value="/styles/images2.jpeg" width="100%" height="100"></h:graphicImage>

</html>
Contents of menu.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:ace="http://www.icesoft.org/icefaces/components"
xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:d="http://java.sun.com/jsf/demo">
<h:form>
<ice:menuBar orientation="Vertical" displayOnClick="true">
<ice:menuItem value="Orders Processing" id="file" >
<ice:menuItem id="so" value="Sale Order"
icon="/images/open.gif"
actionListener="#{menuBarBean.listener}">
<f:param name="myParam" value="Sale Order"/>
</ice:menuItem>
<ice:menuItem id="po" value="Purchase Order"
icon="/images/open.gif"
actionListener="#{menuBarBean.listener}">
<f:param name="myParam" value="Purchase Order"/>
</ice:menuItem>
</ice:menuBar>

</h:form>
</html>
Contents of footer.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">

<h:graphicImage alt="Footer" value="/styles/footer_06.jpg" width="100%" height="100"></h:graphicImage>

</html>
contents of template.xhtml
<!-- template.xhtml -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Sample Template</title>
</h:head>
<h:body>
<h1>#{title}</h1>
<div><ui:insert name="header"/></div>
<div><ui:insert name="menu"/></div>
<p><ui:insert name="content"/></p>
<div><ui:insert name="footer"/></div>
</h:body>
</html>
contents of the concrete page saleorder.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ace="http://www.icesoft.org/icefaces/components"
xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:composition template="/include/template.xhtml">
<ui:define name="header">
<ui:include src="/include/header.xhtml"></ui:include>
</ui:define>
<ui:define name="content">
<hutputText value="Sales Order Processing" styleClass="iceOutTxt" />
<ice:panelGrid columns="2">
<hutputText value="SalesMan" styleClass="iceOutTxt" />
<hutputText value="#{manageSaleOrder.salesmanID}" styleClass="iceOutTxt" />
<hutputText value="Customer" styleClass="iceOutTxt" />
<hutputText value="#{manageSaleOrder.customerID}" styleClass="iceOutTxt" />
<iceutputText value="Item" />

<ice:panelGroup>
<ice:selectOneMenu value="#{manageSaleOrder.selectedProduct}"
valueChangeListener="#{manageSaleOrder.listvaluechangelistener}"
partialSubmit="true">
<f:selectItems value="#{manageSaleOrder.listOfAvailableItem}" />
</ice:selectOneMenu>
</ice:panelGroup>

</ice:panelGrid>

<h:messages></h:messages>
</ui:define>
<ui:define name="footer">
<ui:include src="/include/footer.xhtml"></ui:include>
</ui:define>
<ui:param name="title" value="Here's my Title" />
<ui:define name="menu"><ui:include src="/include/menu.xhtml"></ui:include></ui:define>


</ui:composition>
</html>
When menu is selected event fires and page is displayed according. i.e when "sale order" is clicked page saleorder.xhtml will be renderd.

When page renderd then no event fires when value changes in h:selectOneMenu of saleorder.xhtml.... I hope i have done fine. What could be the problems....

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

The first question to ask in cases like this is "are there other controls on the form that have invalid values?".

When you set a listener on a control, it's not a direct pipeline to the backend code. Unless you are using AJAX, the listener won't be fired until/unless:

1. A Submit of the form is done (typically click on commandButton or commandLink).

AND

2. ALL form control data values are valid. If even one is not valid, the JSF validators will short-circuit the JSF lifecycle steps that include updating the backing bean and firing the listener.

Oh, BTW, you can get rid of those red faces by wrapping your java code and XML with "code" tags. There's a button for it on the message editor form.


Customer surveys are for companies who didn't pay proper attention to begin with.
bilal haider
Ranch Hand

Joined: Feb 08, 2011
Posts: 47

thank you for many corrections.
The point is that when the content of saleorder.xhtml is


Then the

Executes fine. So form is not containing any control with invalid values.

But when the content of saleorder.xhtml is as in the original message, no event is fired.

Waiting....
bilal haider
Ranch Hand

Joined: Feb 08, 2011
Posts: 47

I was expecting a quick reply...
Tim, is there a way?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

It's best not to expect a quick response on the JavaRanch. Since we don't get paid, we have to do this when we aren't actually having to spend time earning a living.

Unfortunately, I haven't worked with IceFaces since they added AJAX support, so I don't know what all the options mean.
bilal haider
Ranch Hand

Joined: Feb 08, 2011
Posts: 47

Sorry....I understand that members here are not-paid and its hard to find time.
Is composition of "saleorder.xhtml" is fine?
bilal haider
Ranch Hand

Joined: Feb 08, 2011
Posts: 47

My understanding of UI composition is right? Is composition of "saleorder.xhtml" is fine?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why events are not fired when value changes in h:selectOneMenu? I am stuck!