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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:58:00+00:00 2026-05-18T02:58:00+00:00

I have a problem I don’t understand: Behind any View I have a controller

  • 0

I have a problem I don’t understand: Behind any View I have a controller ManagedBean that is RequestScoped and a data ManagedBean, that holds the data for the view and is SessionScoped.

So there are two views, which are login with loginData and loginController and overview with overviewData and overviewController.

The functionality should be like that:

  • The User logs into the application (loginController method)
  • If Authentication is successfull, there is a redirect to overview.xhtml (again in loginController method)
  • Then the overviewData gets its data by the overviewController, which retrieves them from business logic layer
  • The overview.xhtml shows the retireved data

So, the point is that I want to fill overviewData out of loginController, right after login! (???or if possible right befor overview view is constructed, if possible???).

I tried it with managedProperties, but the one I initiate in loginController is a different object than the managedProperty in overviewController, although they have the same name! How is that possible.

Oh boy, I doubt you guys understand what I mean, so I need to post some code:

LoginController.java

...    
    @ManagedBean
    @RequestScoped
    public class LoginController {

    @ManagedProperty(value = "#{overviewData}")
    private OverviewData overviewData;
    OverviewController overviewController;

    public LoginController(){
        overviewController = new OverviewController ();
    }

    String login() throws Exception {
      UsernamePasswordToken token = new UsernamePasswordToken(loginData.getName(), loginData.getPw().trim());
      try {
      currentUser.login(token);
      overviewController.fillProjects();
...

OverviewController.java

...    
    @ManagedBean
    @RequestScoped
    public class OverviewController {

    @ManagedProperty(value = "#{overviewData}")
    private OverviewData overviewData;

    public void fillProjects(){
      if(overviewData == null){
        overviewData = new OverviewData();
      }
      overviewData.setProjects(projectService.getProjects()); //retrieves data from business logic
    }
...

OverviewData.java

...
    @ManagedBean(name = "overviewData")
    @SessionScoped
    public class OverviewData {

    private List<ProjectDTO> projects;  //that's what the view needs to display the overview

    public void setProjects(List<ProjectDTO> projects) {
      this.projects = projects;
    }
...

I hope that helps to show my problem, if you don’t understand it, pls ask in a comment..

Would be nice if you can help me 🙂

Cheers…

  • 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-18T02:58:00+00:00Added an answer on May 18, 2026 at 2:58 am

    You’re creating beans yourself using new instead of letting JSF do the job.

    overviewController = new OverviewController ();
    

    and

    overviewData = new OverviewData();
    

    This is wrong. JSF won’t utilize any beans which you’ve created yourself this way. Remove those lines and add another @ManagedProperty on overviewController inside LoginController (and make the property private).

    @ManagedProperty(value="#{overviewController}")
    private OverviewController overviewController;
    

    JSF will create the bean itself and set it as managed property directly after parent bean’s construction. You just have to access it the usual Java way (without the need for nullchecks).

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

Sidebar

Related Questions

I have a problem that I don't understand at all: i = 150 If
So I have a problem that I don't really know how to go about.
I have a problem I don't understand regarding UIViews and Core Animation. Here's what
I have a problem - I don't know the amount of data being sent
I have a problem that I don't know how to solve. I have have
I have a problem which I don't understand and there doesn't seem to be
I have problem with JSON, passing html code, I don't understand because I escaped
I have a strange problem I don't understand... I want to do a PopupWindow
i have problem at jquery post, php get. but i don't get any value.
I have a weird problem I don't understand. I am copying over some C

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.