Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2034
  • Last Modified:

Initialize JSF page?

before JSF page present first,i need initialize back bean data(from database) that the JSF page used.how can i do it?back bean scope is Request.

Thank You!
1 Solution
You can put an empty preStart.jsp page and inside web.xml add this to the welcome page list.


Keep a javaScript for OnLoad() of the page and submit the page to firstPage.jsp with  faces-config.xml having the following navigation rule.

       for navigating from preStart page to firstPage.jsp
              outcome is always success because onLoad will be called first.
              Note: while submitting it on load see to it that you mention the outcome of submit to success.

Just where you are submitting it,

try to write the following :

<h:inputHidden id="putValuesFromDatabase" value="#{PreBacking.methodToSetBeanValuesFromDatabase}"/>

I guess you understood the logic.

All we do here is just put everything with an empty page onLoad as *.do are not present in JSF unlike Java Struts.

I hope u understood me. Thanks. get back to me if you have doubts.

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now