Rick Reumann wrote:

Craig McClanahan wrote the following on 8/22/2005 12:50 PM:

It doesn't ... if you want to fire the standard request processing
lifecycle, you need to actually submit the request.  Using
<jsp:forward page="/foo.faces"/> will cause "/foo.jsp" to be rendered
(assuming you are using the standard extension mappings), entering the
JSF lifecycle at the Render Response phase.

What problem are you trying to solve with <jsp:forward> that can't be
solved a different way?


What I'm trying to figure out is the best way to handle setting up an initial page when someone goes to the welcome page defined in web.xml (ie index.jsp). What's the best way to handle this? On page 20 of Core JSF they give the example of doing something like <jsp:forward page="/index.faces"/> but I don't see how this would ever trigger a method in my backing bean?

For example, in this sample CRUD app I was wanting to load a list of employees right away that would show up on "employees.jsp" I'm keeping this simple and will make this call to getEmployees in my EmployeeBacking bean, but I'm unclear about the best using JSF to fire this method and forward to the appropriate page when the user simply goes to foobarApp/index.jsp ?

Thanks for the help

If I understand you correctly, you have something like: index.jsp does a <jsp:forward> to foo.faces (a jsf page). If so, then I think the backing bean is invoked in foo.faces when the <jsp:useBean> is referenced. So, the backing store bean is already created *before* the foo.faces is rendered to the browser. At least, that's the way it is working for me...

As a quick test, you could create a test foo.faces that contains:
<body>
<jsp:useBean id="foo" class="com.foo.FooBean">
   <jsp:getProperty name="foo" property="*"/>
</jsp:useBean>

The bean has this: <jsp:getProperty name="foo" property ="string"/>
</body>

and have the bean something simple like:

public class FooBean {
   priviate String string = "foo";

   public FooBean() {
      super();
   }

   public String getString() {
      return string;
   }

   public void setString(String string) {
      this.string = string;
   }
}


-david-


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to