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

  • Home
  • SEARCH
  • 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 8626861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:07:57+00:00 2026-06-12T08:07:57+00:00

On my JSF page I’m displaying a simple database table in a dataTable .

  • 0

On my JSF page I’m displaying a simple database table in a dataTable. I want to be able to edit rows in this table. As a solution I made a dialog pop up when you click the value in the first column. I set the current row/entity in my backing bean using setPropertyActionListener. This seems to work. However, the popup disappears after a fraction of a second. I don’t understand why this is. Does anyone have a suggestion?

Here is the JSF-code of my dataTable: (as you can see I’m using PrimeFaces)

<h:form id="dataForm">
    <p:dataTable value="#{misterBean.values}" var="value">
        <p:column>
            <h:commandLink value="#{value.name}" onclick="updateDlg.show()">
                <f:setPropertyActionListener
                    target="#{misterBean.value}"
                    value="#{value}" />
            </h:commandLink>
        </p:column>
        <!-- more columns -->
    </p:dataTable>
</h:form>

and the JSF-code for the dialog:

<p:dialog id="updateDialog" header="Update data" widgetVar="updateDlg">
    <h:form id="updateForm">
        <h:panelGrid columns="2" cellpadding="5">
            <h:outputLabel for="name" value="Name:" />
            <p:inputText id="name" value="#{misterBean.value.name}" />
            <h:outputLabel for="flag" value="Flag:" />
            <p:selectBooleanButton id="flag"
                value="#{misterBean.value.flag}"
                onLabel="On"
                offLabel="Off" />
            <f:facet name="footer">
                <p:commandButton id="submitButton"
                    value="Submit"
                    actionListener="#{misterBean.update}"
                    oncomplete="updateDlg.hide()"
                    update=":dataForm" />
            </f:facet>
        </h:panelGrid>
    </h:form>
</p:dialog>

The backing bean looks like this:

@Controller
@ManagedBean( name = "misterBean" )
@ViewScoped
public final class MisterBean {

    private final MyService myService;
    private final List<Value> values;
    private Value value;

    @Autowired
    public MisterBean( final MyService myService ) {
        this.myService = myService;
        this.values = this.myService.loadValues();
        this.value = new Value();
    }

    public List<Value> getValues() {
        return this.values;
    }

    public Value getValue() {
        return this.value;
    }

    public void setValue( final Value value ) {
        this.value = value ;
    }

    public void update( final ActionEvent e ) {
        this.myService.save( this.value );
        this.value = new Value();
    }

}
  • 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-12T08:07:59+00:00Added an answer on June 12, 2026 at 8:07 am

    Could it be that the page is refreshing right after the dialog is shown? I would suggest trying to use the primefaces commandLink rather than the native jsf commandLink since the primefaces commandLink has ajax=true set by default I believe.

    change <h:commandLink... to <p:commandLink...

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

Sidebar

Related Questions

Can we add multiple rows in the database table from one JSF page in
I want to implement JSF page with AJAX. This is the code of the
I want to import image file into JSF page. I use this code: <div
I made following jsf page. In my Managed Bean i want evaluate the input,
I have made few changes on this huge JSF page, which is full of
I want to create JSF page with tabs. Something like this . But I
If I have a JSF page that I want to link to where I
I want to develop JSF page which can display the swap size if the
I have this JSF page: <div id=settingsdiv style=width:350px; height:400px; position:absolute; background-color:r; top:20px; left:1px> <h:form>
On a JSF page for viewing data, I've an OpenFaces datatable with sorting and

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.