action methods not called when using tiles
New to jsf, so please excuse my lack of knowledge...
I wrote a simple application using commandButtons without tiles and the actions seemed to work fine. Once I tried to embed it into the tile extention example in the coreJavaServerFaces book, my action methods are no longer called (and the content form disappears after I hit the button). Here is some of the code:
book.jsp:
<html>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<f:view>
<head>
<link href="styles.css" rel="stylesheet" type="text/css"/>
<f:loadBundle basename="com.corejsf.messages" var="msgs"/>
<title><h:outputText value="#{msgs.bookWindowTitle}"/></title>
</head>
<body>
<f:subview id="book">
<h:form>
<tiles:insert definition="book" flush="false"/>
</h:form>
</f:subview>
</body>
</f:view>
</html>
bookContent.jsp:
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<c:import url="${param.toolname}.jsp"/>
configuration.jsp
<h:form>
<h:panelGrid columns="5">
<h:commandButton value="Hardware" immediate="true" action="#{controller.GenerateHardwareConfigOutput}"/>
<h:commandButton value="Operating System" action="#{controller.GenerateOSCongigurationOutput}"/>
<h:commandButton value="Network" action="#{controller.MyAction}"/>
<h:commandButton value="Database" action="Database"/>
<h:commandButton value="Application" action="Application"/>
</h:panelGrid>
<f:verbatim><hr></f:verbatim>
<h:panelGrid columns="1">
<h:outputText value="#{controller.commandOutput}"/>
</h:panelGrid>
</h:form>
faces-config.xml:
<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
<faces-config>
<!-- The book -->
<managed-bean>
<managed-bean-name>controller</managed-bean-name>
<managed-bean-class>com.corejsf.ControllerBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>image</property-name>
<value>mh_logo.gif</value>
</managed-property>
<managed-property>
<property-name>image2</property-name>
<value>hdr_support.jpg</value>
</managed-property>
</managed-bean>
</faces-config>
tiles.xml:
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration//EN"
"http://jakarta.apache.org/struts/dtds/tiles-config.dtd">
<tiles-definitions>
<definition name="menu-header-content" path="/headerMenuContentLayout.jsp">
<put name="gridClass"value="headerMenuContent"/>
<put name="headerClass" value="header"/>
<put name="menuColumnClass"value="menuColumn"/>
<put name="contentColumnClass" value="contentColumn"/>
</definition>
<definition name="book" extends="menu-header-content">
<put name="header" value="/bookHeader.jsp"/>
<put name="menu"value="/bookMenu.jsp"/>
<put name="content" value="/bookContent.jsp"/>
</definition>
</tiles-definitions>
public String MyAction()
{
System.out.println("In ControllerBean::MyAction\n");
return("success");
}
public String GenerateHardwareConfigOutput()
{
// XXXXXXXX Demo only -- This will be removed if we go to
//a radio button scheme
public class ControllerBean
{
...
...
System.out.println("In ControllerBean::GenerateHardwareConfigOutput\n");
StringBuffer cmdBuffer = new StringBuffer();
// Run the methods needed to generate the output for the specified
// configuration types, hosts, and destinations
HardwareComponent hw = new HardwareComponent();
cmdBuffer.append(hw.getHostName());
cmdBuffer.append("\n\n");
cmdBuffer.append(hw.GetAllHardwareConfig());
commandOutput = cmdBuffer.toString();
FacesContext.getCurrentInstance( ).renderResponse( );
return("success");
}
I know the ControllerBean is getting instantiated because I see output from other data members.
Thanks in advance for any suggestions you have....

