ajax submit is not working.. using a4j:commandButton
debashis_jboss_forum Mar 3, 2010 1:39 AMHi,
I've designed a wizard with next and previous button using <a4j:commandButton> but somehow corresponding bean is not updated with given values.
For information, all beans are in request scope.
Please help me. This is very urgent..
Following is the main page of the wizard..
[addSource_wizard.xhtml]
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"> type="text/css">
.col1 { vertical-align:top; }
.col2 { vertical-align:top; width:450px; }
.wizard { width:400px; }
.wform td { vertical-align:top; }
.wfcol1 { text-align: right; white-space:nowrap;}
.wfcol2 { }
.wfcol3 { }
.s1row td { height:30px; }
.rich-message { color:red; }
<style
.navPanel {
vertical-align: bottom;
height:23px;
padding-top: 5px;
}
</style>
<h:messages>
<rich:modalPanel id="panel" width="800" height="400">
<a4j:keepAlive beanName="fileSourceConfigBean" />
<f:facet name="header">
<h:panelGroup>
<h:outputText value="Add New Source"></h:outputText>
</h:panelGroup>
</f:facet>
<f:facet name="controls">
<h:panelGroup>
<a onclick="Richfaces.hideModalPanel('panel');" href="#">Close</a>
</h:panelGroup>
</f:facet>
<a4j:form id="add_src_page1_form" ajaxSubmit="true">
<div style="height: 100%" id="wizard">
<a4j:include viewId="/includes/wizard/pages/addSource_page1.xhtml" />
</div>
</a4j:form>
</rich:modalPanel>
</h:messages>
</ui:composition>
-----------------------------------------------------------------------------------------------------------
[addSource_page1.xhtml]
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<div style="position: relative; width: 100%; height: 80%;">
<fieldset>
<h:panelGrid columns="4" style="width: 100%;">
<h:outputLabel value="Source Name" for="srcName" />
<h:inputText id="srcName" value="#{fileSourceConfigBean.srcName}"
required="false" />
<h:outputLabel value="Source Description" for="srcDesc" />
<h:inputTextarea id="srcDesc" value="#{fileSourceConfigBean.srcDesc}"
required="false" />
<h:outputLabel value="Source Type" for="srcTyp" />
<h:selectOneMenu id="srcTyp" value="#{fileSourceConfigBean.srcTyp}">
<f:selectItems value="#{lOVList.srcTypList}" />
</h:selectOneMenu>
<h:outputLabel value="Destination Type" for="destTyp" />
<h:selectOneMenu id="destTyp" value="#{fileSourceConfigBean.destTyp}">
<f:selectItems value="#{lOVList.destTypList}" />
</h:selectOneMenu>
<h:outputLabel value="Destination Table" for="tblName" />
<h:inputText id="tblName" value="#{fileSourceConfigBean.destTable}"
required="false" />
</h:panelGrid>
</fieldset>
</div>
<div class="navPanel" style="width: 100%; height: 20%;">
<a4j:commandLink
style="float:right;vertical-align: bottom;" action="#{fileSourceConfigBean.viewNextPage}"
value="Next >>" immediate="true" ajaxSingle="true" />
</div>
</ui:composition>
---------------------------------------------------------------------------------------------------------------------
Partial faces-config.xml
<navigation-rule>
<from-view-id>/includes/wizard/pages/addSource_page1.xhtml</from-view-id>
<navigation-case>
<from-action>#{fileSourceConfigBean.viewNextPage}</from-action>
<from-outcome>next</from-outcome>
<to-view-id>/includes/wizard/pages/addSource_file_page2.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
Regards,
Debashis