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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:04:53+00:00 2026-06-09T22:04:53+00:00

I create a bean as @ManagedBean @RequestScoped public class KhachHangMB implements Serializable { @PersistenceContext(unitName

  • 0

I create a bean as

@ManagedBean
@RequestScoped
public class KhachHangMB implements Serializable {
@PersistenceContext(unitName = "XoSoWebPU")
private EntityManager em;
private List<KhachHang> l;

public KhachHangMB() {
    l = new ArrayList<KhachHang>();
}
@PostConstruct
public void init() {
    l = new ArrayList<KhachHang>();
    l = em.createNamedQuery("KhachHang.findAll").getResultList();
    MsgShow.showMsg("", "Init " + Math.random());
}

public List<KhachHang> retriveAllKhachHang() {
    return l;
}

}

And my jsf page:

<h:form>
            <h1><h:outputText value="List"/></h1>
            <h:dataTable value="#{khachHangMB.retriveAllKhachHang()}" var="item">
                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Idkh"/>
                    </f:facet>
                    <h:outputText value="#{item.idkh}"/>
                </h:column>
                <h:column>
                    <f:facet name="header">
                        <h:outputText value="TenKH"/>
                    </f:facet>
                    <h:outputText value="#{item.tenKH}"/>
                </h:column>
                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Cmnd"/>
                    </f:facet>
                    <h:outputText value="#{item.cmnd}"/>
                </h:column>
                <h:column>
                    <f:facet name="header">
                        <h:outputText value="DiaChi"/>
                    </f:facet>
                    <h:outputText value="#{item.diaChi}"/>
                </h:column>
                <h:column>
                    <f:facet name="header">
                        <h:outputText value="SoDT"/>
                    </f:facet>
                    <h:outputText value="#{item.soDT}"/>
                </h:column>
                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Email"/>
                    </f:facet>
                    <h:outputText value="#{item.email}"/>
                </h:column>
                <h:column>
                    <f:facet name="header">
                        <h:outputText value="MaDuThuong"/>
                    </f:facet>
                    <h:outputText value="#{item.maDuThuong}"/>
                </h:column>
                <h:column>
                    <f:facet name="header">
                        <h:outputText value="GhiChu"/>
                    </f:facet>
                    <h:outputText value="#{item.ghiChu}"/>
                </h:column>
                <h:column>
                    <f:facet name="header">
                        <h:outputText value="MatKhau"/>
                    </f:facet>
                    <h:outputText value="#{item.matKhau}"/>
                </h:column>
            </h:dataTable>
            <h:commandLink value="Click" action="home" />
        </h:form>

And my faces-config

<navigation-rule>
    <navigation-case>
        <from-outcome>trungthuong_list</from-outcome>
        <to-view-id>/f_trungthuong/trungthuong_list.xhtml</to-view-id>
        <redirect/>
    </navigation-case>
</navigation-rule>
<navigation-rule>
    <navigation-case>
        <from-outcome>home</from-outcome>
        <to-view-id>index.xhtml</to-view-id>
        <redirect/>
    </navigation-case>
</navigation-rule>

I click on command link the random was called but the data on page was not change although i have been edited data on database. Another case, i navigate to other page after that i return but the data is old (not using back of web browser, i’m using command link)! Please help me!

  • 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-09T22:04:55+00:00Added an answer on June 9, 2026 at 10:04 pm

    I think you should try setting the option Shared Cache Mode in the file persistence.xml to None. This helped me to solve a problem similar to yours some time ago. 🙂

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

Sidebar

Related Questions

package no.northcreek.mabjo; import javax.annotation.ManagedBean; import javax.faces.bean.ManagedProperty; import javax.faces.bean.RequestScoped; @ManagedBean @RequestScoped public class indexBean {
I have the following code: JSF Managed Bean: @ManagedBean(name = purchaseView) @ViewScoped public class
I had the following JSF backing bean in my Webapp @ManagedBean class MyBackingBean implements
I have a class which would create a bean and the bean has few
I have the following 2 ManagedBean: @ManagedBean @ViewScoped public class MakeReservation { ... @ManagedProperty(value=#{cartManagedBean})
I am using JSF 2.0 Mojarra. I need to create a Managed Bean that
I want to dynamically create object of HtmlDivElement in my jsf managed bean and
I am trying to create a bean and than trying to inject the same
I followed the instructions: create the bean. This bean is for an enum transferred
I would like to be able to create a bean whose scope is limited

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.