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 8682561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:48:36+00:00 2026-06-12T21:48:36+00:00

I m creating an app using JSF. The problem I have is that every

  • 0

I m creating an app using JSF. The problem I have is that every time I refresh the page the action of the commandbuton is executed (ProjectEntityHandlerBean.insertNewProject) resulting in multiple unwanted entries in Database. I looked to a related thread but didnt help in my case :

How to avoid re-execution of last form submit action when the page is refreshed?

Below is the .xhtml code, the bean`s code. If anybody can help, I would be grateful…

public String insertNewProject()
{   
    System.out.println("Enter insert method");
    Project project = new Project();
    project.setProjectName(this.projectName);
    project.setDescription(this.description);
    project.setDuration(this.duration);
    ProjectHandler ph = new ProjectHandler();
    ph.create(project);
    return "viewid?faces-redirect=true";


}

<p:tab title="Insert">
            <h:form style="height: 500px; ">
                Insert new Project
                    <h:panelGrid border="2" columns="2" style="height: 200px; width: 383px; ">
                        <h:outputText value="project name"></h:outputText>
                        <h:inputText value="#{ProjectEntityHandlerBean.projectName}"></h:inputText>
                        <h:outputText value="project description"></h:outputText>
                        <h:inputText value="#{ProjectEntityHandlerBean.description}"></h:inputText>
                        <h:outputText value="project duration (Months)"></h:outputText>
                        <h:inputText value="#{ProjectEntityHandlerBean.duration}"></h:inputText>
                    </h:panelGrid>
                    <h:commandButton value="Submit" action="#{ProjectEntityHandlerBean.insertNewProject}"></h:commandButton>
            </h:form>       
        </p:tab>
  • 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-12T21:48:37+00:00Added an answer on June 12, 2026 at 9:48 pm

    If you post data, then refresh the page, browsers WILL resend the data. Some will warn first.

    One way of preventing this is to use ajax for post, but then navigation after post is limited. Ajax can be enabled by a simple <p:ajax process="@form" update="@form"/> child of the commandButton, or by using primefaces own commandbutton <p:commandButton ajax="true" process="@form" update="@form"/>.

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

Sidebar

Related Questions

I am creating an iPad app using XCode 4 and Storyboards. I have a
Problem : I am creating an iOS chat app using the XMPPFramework and an
i try creating client-server app using socket. i already succeed doing that with the
I'm creating an app using PHP that part of what its supposed to do,
Creating simple app using GAE / Django-nonrel (I don't think the problem is specific
I'm creating web-app using JSR286, Struts2 for portlets on WebSphere Portal 6.1.5 The problem
I have a Grails 2.0.0 project that was created using grails create-app . In
I am creating a web app using geolocation. So far I have it set
I am creating Travel guide app using core data. I have 4 entities CITY
I am creating an app using phonegap+jquery mobile.I have three radio buttons and a

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.