I start JSF 2, I create a xhtml page is index.xhtml
, this page have a button:
<h:commandButton value="Submit" action="welcome" />
And I create a page welcome.xhtml
.
But when I view source of index.xhtml
, I don't see any "link" from index.xhtml
file to welcome.xhtml
file, how jsf can pass from index to welcome?
When I view source, source page is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body lang="en">
<form id="j_idt5" name="j_idt5" method="post" action="/Test/index.xhtml" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="j_idt5" value="j_idt5" />
<input type="submit" name="j_idt5:j_idt6" value="Submit" /><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="-5517223312856481273:-1605099621977497303" autocomplete="off" />
</form></body>
</html>
I realy don't see a "link" or action to "welcome", in hidden field, I see ViewState
but it auto generate and change when I refesh page. I also don't see any JavaScript code for load welcome page.
After run with <h:link>
, I think, when first time, jsf read index.xhtml
and show it, after submit be press, jsf read index.xhtml
and get action of this button and show welcome page.