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

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

Initialize JSF page?

hello,
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!
konrad
0
konrad_ying
Asked:
konrad_ying
1 Solution
 
arun99907Commented:
You can put an empty preStart.jsp page and inside web.xml add this to the welcome page list.

      <welcome-file-list>
         <welcome-file>preStart.jsp</welcome-file>
      </welcome-file-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.

<navigation-rule>
    <description>
       for navigating from preStart page to firstPage.jsp
    </description>
    <from-view-id>/preStart.jsp</from-view-id>
    <navigation-case>
        <description>
              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.
        </description>
      <from-outcome>success</from-outcome>
      <to-view-id>/firstPage.jsp</to-view-id>
    </navigation-case>
  </navigation-rule>

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.
0

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