h:commandButton not worked in modalPanel
jackrobert1985 Jul 19, 2011 10:19 PMHi,
h:commandButton action not worked in modalPanel.
I am using Netbeans IDE7 and Tomcat 6.0.29 , richfaces finall 3.3.3 jars
I am using t:inputFileUpload component for upload file. In my richModalPanel have one <h:commandButton/>.
My requirement : After browse the file, and click commandBuuton, then i want to show the selected file name in ModalPanel.
My problem is :
When i click commandbutton in modalPanel, not called commandButton action in bean, and automattically close the modalPanel.
In that action method starting...just i put System.out.println("Uploading process to be start..."); Even this output not print in my tomcat log.
In my following code, i don't know what i mistake...
Otherwise is any otherway to show the uploaded file name in modalpanel
upload.jsp
<body> <h:form id="UploadForm" binding="#{FileUpload.intiForm}"> <a4j:outputPanel id="uploadOutputPanel"> <a4j:commandButton value="ShowModalPanel" action="#{FileUpload.showUploadPanelAction}" oncomplete="#{rich:component('uploadImagePanel')}.show()" reRender="uploadImagePanel,uploadOutputPanel"/> </a4j:outputPanel> </h:form> <rich:modalPanel id="uploadImagePanel" moveable="true" top="150" width="400" autosized="true"> <h:form id="uploadForm" enctype="multipart/form-data" > <h:panelGrid id="uploadPanelGridId" columns="2"> <t:inputFileUpload id="uploadFile" value="#{FileUpload.logoImageFile}" size="54"/> <h:commandButton id="UploadButton" value="Upload" action="#{FileUpload.uploadFileAction}"/> <h:outputText value="Uploaded File Name : #{FileUpload.fileName}"/> </h:panelGrid> </h:form> </rich:modalPanel> </body>
FileUpload.java
import javax.faces.component.html.HtmlForm; import org.apache.myfaces.custom.fileupload.UploadedFile; /** * * @author eswar */ public class FileUpload { private HtmlForm intiForm; private String fileName; private UploadedFile logoImageFile; public String showUploadPanelAction() { System.out.println("Show Upload Panel Action ....."); //This line showing in tomcat log, when i click "ShowModalPanel" button --> a4j:commandButton return ""; } public String uploadFileAction() { System.out.println("Uploading process to be start...."); //But this line NOT show in my tomcat log, when i click "UploadButton" --> h:commandButton System.out.println("logoImageFile : " + logoImageFile); if(logoImageFile != null) { fileName = logoImageFile.getName(); } return ""; } public HtmlForm getIntiForm(){ System.out.println("Page initializing......"); //This line showing in tomcat log, when the page loading time return intiForm; } public void setIntiForm(HtmlForm intiForm) { this.intiForm = intiForm; } public UploadedFile getLogoImageFile(){ return logoImageFile; } public void setLogoImageFile(UploadedFile logoImageFile){ this.logoImageFile = logoImageFile; } public String getFileName(){ return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } }
Please help me.
Thanks in advance.