Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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

 
Ranch Hand
Posts: 47
Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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">
<h:outputText value="Sales Order Processing" styleClass="iceOutTxt" />
<ice:panelGrid columns="2">
<h:outputText value="SalesMan" styleClass="iceOutTxt" />
<h:outputText value="#{manageSaleOrder.salesmanID}" styleClass="iceOutTxt" />
<h:outputText value="Customer" styleClass="iceOutTxt" />
<h:outputText value="#{manageSaleOrder.customerID}" styleClass="iceOutTxt" />
<ice:outputText 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....

 
Saloon Keeper
Posts: 24819
172
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
bilal haider
Ranch Hand
Posts: 47
Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 47
Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was expecting a quick reply...
Tim, is there a way?
 
Tim Holloway
Saloon Keeper
Posts: 24819
172
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 47
Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 47
Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My understanding of UI composition is right? Is composition of "saleorder.xhtml" is fine?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic