The page needs to be redirected to the external site with the post parameter, but I can use vanilla HTML
& lt; Can not use form action =;
"Url" & gt; As explained here:
Because then the form will be within a JSF form - and it does not work.
Is it possible to use:
FacesContext.getCurrentInstance (). GetExternalContext (). Redirect ("http://example.com"); With any type of extra vanilla without POST parameter? Or is there any other way to get it without the form?
Try something like this:
JAVASCRIPT: < Pre> function redirect () {document.getElementById ("mySubmitButton"). Submit (); } XHTML:
& lt; H: form & gt; & Lt; Span onclick = "javascript: redirect ()" class = "linkClass" & gt; Redirects & lt; / Span & gt; & Lt; / H: form & gt; & Lt; Div style = "display: none:" & gt; & Lt ;! - If you want to hide it - & gt; & Lt; Form action = "http: //external/myplace.html" method = "post" & gt; & Lt; Input type = "hidden" value = "value1" & gt; & Lt; / Input & gt; & Lt; Input type = "submit" id = "mySubmitButton" & lt; / Input & gt; & Lt; / Form & gt; & Lt; / Div & gt; Edit: Added another test. dynamic dynamic parameters : In this example we believe that we always send a value.
JAVASCRIPT: Function Redirected (dynamic value) {document.getElementById ("Dynamicfield"). Value = dynamicValue; Document.getElementById ("mySubmitButton") presented (). } XHTML:
& lt; H: form & gt; & Lt; Span onclick = "javascript: redirect ('myValue')" class = "link class" & gt; Redirects & lt; / Span & gt; & Lt; / H: form & gt; & Lt; Div style = "display: none:" & gt; & Lt ;! - If you want to hide it - & gt; & Lt; Form action = "http: //external/myplace.html" method = "post" & gt; & Lt; Input id = "dynamic field" type = "hidden" value = "" & gt; & Lt; / Input & gt; & Lt; Input type = "hidden" value = "value1" & gt; & Lt; / Input & gt; & Lt; Input type = "submit" id = "mySubmitButton" & lt; / Input & gt; & Lt; / Form & gt; & Lt; / Div & gt;
No comments:
Post a Comment