JSF commandButton - passing POST params to an external site

久未见 提交于 2019-12-31 03:16:07

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/17228844/jsf-commandbutton-passing-post-params-to-an-external-site

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!