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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:12:57+00:00 2026-06-05T02:12:57+00:00

I am developing a web app using jsf technology. I want a method of

  • 0

I am developing a web app using jsf technology. I want a method of my backing bean to be
invoked when the home page of my app is displayed. Usually, a backing bean method
gets involved when a user clicks on a link or a button.

In short I want my backing bean to get some data from the database and send it to the
jsf page, and I want this to occur when a user invokes the home page link
of my app.

Here is how I wanted to solve the problem: use a servlet that is executed when
the expected link is invoked, and call the backing bean from that servlet; but the problem
is I am having some difficulties with the url-pattern of the servlet in the web.xml file. The home page link of my app is: home.jsf. The name of my servlet is
HomeServlet and here is how I configured it in the web.xml file:

   <servlet>
       <servlet-name>HomeServlet</servlet-name>
       <servlet-class>utils.HomeServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
   </servlet>
   <servlet-mapping>
       <servlet-name>HomeServlet</servlet-name>
       <url-pattern>/home.jsf</url-pattern>
   </servlet-mapping> 

So when I run the app, the servlet is executed, but my home.jsf page is empty (completely blank). I don’t know why.

So what I want to know is:

  • Am I using the right approach for this issue?

  • If yes, which url-pattern should I use?

  • 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-05T02:12:58+00:00Added an answer on June 5, 2026 at 2:12 am

    No, this is definitely not the right approach. You’re working your way around JSF. You’re supposed to do the job just in the constructor or @PostConstruct method of the request or view scoped JSF managed bean associated with the view.

    E.g.

    @ManagedBean
    @RequestScoped
    public class Home {
    
        public Home() {
            // Here.
        }
    
        @PostConstruct
        public void init() {
            // Or here. This will be invoked *after* any dependency injections,
            // such as @EJB, @ManagedProperty, @Inject, @Resource, etc.
        }
    
        // ...
    }
    

    Whenever JSF encounters a #{home.someproperty} reference in the home.xhtml (or home.jsp) for the first time, then the bean will just be constructed.

    When developing with JSF, you shouldn’t have any need to develop other servlets. In JSF, the FacesServlet is the sole servlet which already does all the necessary request/response and model/view controlling job.

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

Sidebar

Related Questions

I am developing a web app using ASP.NET 2.0 (C#), where on home page
I'm developing a web app using JSF 2.0 + PrimeFaces 2.2.1 Now I think
I'm developing a java EE web app using JSF with a shopping cart style
I'm developing web app using jsp. What I want to do is, if a
I am developing a web app using servlets and jsps. I have a question
I am developing a web app (using rails) that I will be launching within
I am developing an web app using Codeigniter. In this app I got a
I'm developing a web app and currently using sql server 2008 for it. But,
I'm developing a web app, using Play framework and javascript, but exactly I don't
I'm developing an internal web app on our company intranet using PHP. One section

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.