5

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

Austin
  • 1,087
  • 3
  • 14
  • 27

1 Answers1

2

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>
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • I always get `javax.servlet.ServletException: null source ` when I try to insert a plain html `
    ` into a JSF page
    – Austin Aug 14 '12 at 13:07
  • or when I try to set the action of a `` to a URL – Austin Aug 14 '12 at 13:08
  • 2
    The `null source` exception is recognizeable as a bug in older Mojarra versions which can under the covers actually be caused by a simple XML syntax error. E.g. a missing closing tag or missing quotes. See also http://stackoverflow.com/questions/4792437/java-lang-illegalargumentexception-null-source/4793340#4793340 As to the incorrect way of using the `action` attribute of the ``, I have nowhere told/answered that you can do that, so I'm not sure why you're trying to do that. – BalusC Aug 14 '12 at 13:10
  • just saying what I had tried. as always, you're the best. Thanks! – Austin Aug 15 '12 at 15:48