2

I need a link which redirect me to a different site and send POST parameters. Something like:

  <h:form> 
    <h:commandButton value="submit" action="http://example.com"> 
      <f:param name="user" value="robson"> 
    </h:commandButton> 
  </h:form>

The code above doesn't work of course.

I'd like to acheive this in HTML:

  <form action="http://example.com" method="POST">
    <input type="hidden" name="user" value="robson">
    <input type="submit" value="submit">
  </form>

Is that possible?

robson
  • 1,623
  • 8
  • 28
  • 43
  • @BalusC - as you could see in my other question [link](http://stackoverflow.com/questions/17232209/facescontext-redirect-with-post-parameters) - the problem now is form in form. I learned that plain HTML is good – robson Jun 21 '13 at 11:20

1 Answers1

5

Use the vanilla HTML <form> tag, not the JSF tag if you're going to send form data to a non-JSF target.

The JSF form tag is designed to facilitate JSF postback operations, which is why it has no "action" attribute.

Vikas V
  • 3,176
  • 2
  • 37
  • 60
  • Can I use jsf components inside `
    ` or just HTML ones?
    – robson Jun 21 '13 at 07:03
  • Should work. You might face [http://stackoverflow.com/questions/4089076/the-form-component-needs-to-have-a-uiform-in-its-ancestry-suggestion-enclose-t](the-form-component-needs-to-have-a-uiform-in-its-ancestry-suggestion-enclose-t) – Vikas V Jun 21 '13 at 07:09
  • I have problem yet with `
    ` in `` - and I have to manage with it, but it indeed works, thank you
    – robson Jun 21 '13 at 08:44
  • You are welcome ... If you are facing some other problem, please raise it as a new question. – Vikas V Jun 21 '13 at 08:50
  • Thanks, I had to do this :( – robson Jun 21 '13 at 09:49