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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:33:54+00:00 2026-05-22T19:33:54+00:00

According this article , I’ve implemented @ManagedProperty(value=#{settings}) to my backing bean: BEAN Bde.java: @Entity

  • 0

According this article, I’ve implemented @ManagedProperty(value="#{settings}") to my backing bean:

BEAN Bde.java:

@Entity
@Table(name="bdeDATA")
@ViewScoped
@ManagedBean(name="BDE")
public class Bde implements Serializable
{
  /**/
  private static final long serialVersionUID = -705775502999920673L;

  @Transient
  @ManagedProperty(value = "#{settings}")
  private Settings settings;

  @Id
  private Date create_date;
  private Integer person_ID;

  public Date getCreate_date() {
    return create_date;
  }
  public void setCreate_date(Date create_date) {
    this.create_date = create_date;
  }
  public Integer getPerson_ID() {
    return person_ID;
  }
  public void setPerson_ID(Integer person_ID) {
    this.person_ID = person_ID;

    try 
    {
      Settings.PWKITEM = (Pwk)Tools.find(person_ID);
      if (Settings.PWKITEM != null) settings.setUserfound(true); /// PROBLEMATIC
    }
    catch (Exception e)
    {
      Tools.setErrorMessage("NOT FOUND "+e.getMessage());
    }
  }

  // ManagedProperty settings ---------------------------------------------  
  public Settings getSettings() {
    return settings;
  }
  public void setSettings(Settings settings) {
    this.settings = settings;
  }
  public void setUserfound (boolean userfound){
    settings.setUserfound(userfound);
  }
  public boolean isUserfound() {
    return settings.isUserfound();
  }
}

Settings.java:

@SessionScoped
@ManagedBean(name="settings")
public class Settings implements Serializable
{
  /**/
  private static final long serialVersionUID = 8613411699115714416L;

  public static Pwk PWKITEM = new Pwk(); 
  private boolean userfound = false;  

  public boolean isUserfound() {
    return userfound;
  }
  public void setUserfound(boolean userfound) {
    this.userfound = userfound;
  }
}

XHTML (ajax call setPerson_ID):

<h:inputText id="persId" value="#{bean.bdeitem.persId}">
  <f:ajax event="blur" render="name" execute="@this" />
</h:inputText>
<h:inputText id="name" value="#{bean.pwkitem.name}"/>

Problem is in try/catch:

  • without the condition, object is found.
  • when I change the condition for example to if (Settings.PWKITEM != null) System.out.println("HELLO"), HELLO is writen to console.
  • if i try to add the userfound setter, it is catched (“NOT FOUND”).

What I’m doing wrong?

  • 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-05-22T19:33:55+00:00Added an answer on May 22, 2026 at 7:33 pm

    Your question looks seriously confusing. You first show some bean code and then immediately say “I though that is an ajax problem,”, before even mentioning any kind of problem. The rest of the question is not much different.

    To directly answer the last part of your question though:

    Ican’t understand, why it find the item an writes the correct name to console, and immediatelly after that, it writes catch exception not found….????

    You are accessing Settings statically. The instance you have declared at the class level seems to be useless. It’s fully possible that if Tools.find throws an exception and thus no new value is assigned, that there is still an old value in the static Settings.PWKITEM field. There is nothing strange about that.

    Do note that the log reads from top to bottom. So it’s not that “***” is printed and then the exception is thrown, but the exception is first thrown and “Not Found” is printed, and only thereafter “***” is printed.

    Additionally, your approach to all of this looks problematic. Declaring an Entity to also be a (JSF) backing bean is rarely a good idea. Using references to some kind of Service or DAO classes from within an entity is also not always a good idea, but doing this in a method that is supposedly a simple setter for an ID simply looks wrong.

    Then using static references is even more wrong and to top if off, using underscores in method and non-static variable names goes against the common Java code convention.

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

Sidebar

Related Questions

I implemented Dynamic DataSource Routing for Spring+Hibernate according to this article . I have
According this MSDN article HttpApplication .EndRequest can be used to close or dispose of
According to this article Silverlight 2 Beta 2 supports the DataContractJsonSerializer object. But, when
According to this article rebasing is not necessary for .NET assemblies due to JIT
According to this article from Herb Sutter, one should always pick Class Specializing over
According to this article: http://subsonicproject.com/docs/3.0_Migrations Bottom line: if you're a developer that is concerned
According to this article it should be a Javascript 2.0 way to define class.
According to this article if I register my COM object with either Both or
According to this article , it's possible to get multiline XML comments -- instead
According to this article about writing shell extensions in .Net, inheriting the shell interfaces

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.