Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9206355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:09:29+00:00 2026-06-18T00:09:29+00:00

I have a webapp where I select some content to be deleted. A modal

  • 0

I have a webapp where I select some content to be deleted. A modal pops-up displaying a preview of the image/flash selected. I hit a button and everything works fine. But, when I select another content to be deleted, the modal pops-up and, for a microsecond, it displays the previously deleted file which is then replaced by the new content I want to delete.

The code for showing the dynamic content is as follows:

For images:

<p:graphicImage value="#{controller.tempImage}" height="110" 
    id="imageID" />

For flash:

<p:media value="#{controller.tempImage}" width="110" height="110" 
    id="imageID" player="flash" /> 

Controller:

public StreamedContent getTempImage() {
    try {
        FacesContext context = FacesContext.getCurrentInstance();

        if (context.getRenderResponse() ) {
            return new DefaultStreamedContent();
        }
        else {              
                tempImage = new DefaultStreamedContent(new FileInputStream("pathToFile"), "image/jpeg");                
        }
    } catch (FileNotFoundException e) {
        tempImage = new DefaultStreamedContent();
    }

    return tempImage;
}

I tried setting tempImage to null before loading and autoUpdate=true in the modal but no luck.

Delete button (the one that shows the delete modal):

<p:commandButton id="btnDelete" value="Delete" onclick="deleteModal.show();"  actionListener="#{controller.initDelete}" update=":deleteForm">                                       

Delete form (xhtml):

<h:form  id="deleteForm" enctype="multipart/form-data" >
<p:dialog id="deleteDialog" widgetVar="deleteModal" modal="true" resizable="false" draggable="false" autoUpdate="true">
        <p:outputPanel autoUpdate="false" >
            <p:panelGrid id="panelId">
                <p:row>                 
                    <p:column>
                        <p:panelGrid id="bannerPanel">

                            <p:row>
                                <p:column>
                                 <p:graphicImage value="#{controller.tempImage}" height="110" id="imageID" />
                                </p:column>
                            </p:row>    

                        </p:panelGrid>
                    </p:column>
                </p:row>

                <f:facet name="footer">
                    <p:row>
                        <p:column>  
                                <p:commandButton id="doDeleteBtn" value="Delete"
                                     actionListener="#{controller.delete}" >                                                        
                                </p:commandButton>
                        </p:column>
                    </p:row>
                </f:facet>
            </p:panelGrid>
        </p:outputPanel>
</p:dialog>            

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:09:30+00:00Added an answer on June 18, 2026 at 12:09 am

    Change from:

    onclick="deleteModal.show();"
    

    to:

    oncomplete="deleteModal.show();"
    

    This will ensure that your dialog is viewed after AJAX request is completed, not before it is started.

    You should use onclick, when you are creating so called push buttons, the buttons with type="button", which are just executing some JavaScript. Default type of buttons in Primefaces is submit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Imagine I have some webapp with a lot of different filters, which impact e.g.
I have some kind of webapp here, which of course incorporates JavaScript and jQuery.
I have a web app which lets the user select the excel spreadsheet and
I have a webapp to be ran on Tomcat6/JbossAS 5 and, for versioning purposes,
I have a webapp that lists all of my artists, albums and songs when
I had the following idea: Say we have a webapp written using django which
OKay I lost alsmost the whole day on this. I have a webapp where
I have a maven3 webapp (war) project that has 2 dependencies. One is a
I have a java webapp which needs to upload files via http and then
I have created a webapp using maven2 archetype in netbeans 6.7. when I do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.