简体   繁体   English

从jsp页面自动提交HTML表单

[英]auto submit html form from jsp page

I'm hitting the same origin policy with Ajax. 我正在使用Ajax制定相同的原产地政策。 However I need to make a form post to another server. 但是,我需要将表单发布到另一台服务器。

So here is the question: How do I make a call to my JSP and have that JSP auto submit a form to another server? 所以这是一个问题:我如何打电话给我的JSP,并让JSP自动向另一个服务器提交表单?

I have tried using the AJAX call to my JSP page but now i cannot get the page to actually submit the form, when it returns back the httpRequest i end up with just the plain HTML from that page. 我已经尝试过使用对JSP页面的AJAX调用,但是现在我无法使页面真正提交表单,当它返回httpRequest时,我最终仅获得该页面的纯HTML。

cURL equivalent in JAVA 相当于JAVA中的cURL

Set your variables and connection via HttpURLConnection then send with Post headers to your remote. 通过HttpURLConnection设置变量和连接,然后将Post标头发送到遥控器。

The response of that can be forwarded as a response to JavaScript from XHR since its on the same domain. 由于XHR在同一个域中,因此它的响应可以作为来自XHR的JavaScript响应转发。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM