jsf 2 - Does the JSF lifecycle reapply to the outcome Facelet when I navigate? -
I have a simple login. XHTML Facet that contains a username and password input and command buttons are just a action = "welcome"
result in the command button which displays the welcome.xhtml facelet.
I am very new to JSF as I have read the life cycle of JSF, when I click on the button, the applicant application handles the lifeline navigation and render (??) welcome.xhtml I am still confused if welcome.xhtml starts the life cycle of a new face or not.
PS: I know that the url does not change in welcome.xhtml. Is the life cycle of JSF bound up on request?
Yes, the life cycle of JSF is Request-bound and yes, by default it is Same will be presented in the request.
A key that is confusing you is " forward " vs. " Redirection in the context of HTTP sublet requests"> "
JSF progresses the request for the target page by default. If you know the Seral API well, then you will understand that it is under the following types of hood:
request.getRequestDispatcher ("welcome.xhtml"). Forwarded (request, response);
This way the target page has access to the same request object if the goal page is different from the page where the form (in fact login.xhtml < / Code>), you will not see the change that appears in the browser address bar.
In the navigation case you have a & lt; Redirect / & gt; By adding
or
ExternalContext # redirect (),
in Bean's Action Method, or by adding faces-redirect = true
parameter to the action of the button, a good JSF In the 2.0 mode:
& lt; H: commandButton value = "login" action = "Welcome? Faces-redirect = true" /> Either way, this is the following in the Servlet API terms: response.sendRedirect ("welcome.xhtml");
who instructs instructions to set a new GET request to the customer at a given location. Note that in this way, any requests- and ski-beans of the initial request will be seen and trashed.
Comments
Post a Comment