java - File upload using AJAX instead of form submission -


i trying upload file, using rich:fileupload control, able too. problem facing here, when click on upload button in file upload control, page gets submitted, trying avoid.

what trying do, upload button clicked, listener called necessary backend operations. , section refreshed picture displayed. running fine want file uploading via ajax.

i using richfaces 4.1

<rich:fileupload addlabel="add photo" clearalllabel="clear all" clearlabel="clear"     deletelabel="remove" donelabel="upload successful!"     uploadlabel="upload profile pic"     fileuploadlistener="#{studentprofile.fileuploadlistener}"     acceptedtypes="jpg, gif, png, bmp" noduplicate="true" immediateupload="false">     <!-- <a4j:ajax event="uploadcomplete" render="validationbutton"/> -->     <!-- <a4j:ajax event="clear" listener="#{uploadbean.doclearfileslist}" render="validationbutton"/> -->             <a4j:ajax event="uploadcomplete" render="profilepic" immediate="true" /> </rich:fileupload>    <a4j:outputpanel ajaxrendered="true" id="profilepic">         <rich:panel header="profile picture" style="width: 100px;height: 100px">     <h:graphicimage url="#{studentprofile.profilepictureurl}" width="100" height="100" />         </rich:panel> </a4j:outputpanel> 


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -