I cannot redirect to another page if the code is like this:
The
doesn't generate a submit button. It just generates a "dead" button without any effects, purely intented to be used for custom onclick="..."
scripts and like. This is somewhat a leftover of the dark JSF 1.0/1.1 era, when it wasn't nicely possible to just use plain vanilla HTML in JSF for this kind of things.
The
performs the submit by ajax powers through JSF-generated onclick
. It doesn't care about the button's type
.
Essentially, removing type="button"
and relying on its default type="submit"
should fix your problem.
However, all with all, if this is the real code and you don't actually intend to invoke a bean action, then you're going in completely the wrong direction as to implementing the functional requirement of navigating to a different page by a button. You should be using
instead.