问题
Is there any way to call a URL action within a <h:commandButton>, or for that matter a <h:form>? I'm trying to bypass my email's login page from my own website, so I'm using JSF beans to hold my login info in <h:inputSecret> tags so that I can simply click "Go to Email" and because I'm logged in to my own website, I could go straight to my inbox w/o logging in again
回答1:
Just use plain HTML <form> instead of JSF <h:form>.
<form action="http://example.com/mail" method="post">
<input type="text" name="username" value="#{bean.username}" />
<input type="password" name="password" value="#{bean.password}" />
<input type="submit" value="Go to Email" />
</form>
来源:https://stackoverflow.com/questions/11939807/jsf-form-with-url-action