0

here is my problem. I have this xhtml page:

<html>
<body>
<script>

function myFunction() {
var link='#{myController.goMyDetails}' + MyId
var MyId = '#{myController.myDetails.getId()}';
self.location=link;

}
</script>


<input type="button" id="LinkBtn" onclick="myFunction()" value="Go Details" />


</body>
</html>

What I need it to do is open itself again but with the called Controller.goMyDetails and the Id in MyId as parameter for the controller.

So I click the button and I get the Controller.goMyDetails called with MyId as parameter.

Is there anyway to do this with javascript. No Primefaces or other stuff.

Thank you for your help, this is driving me mad.

Tiny
  • 24,933
  • 92
  • 299
  • 571
Viking
  • 73
  • 8
  • Who told you OmniFaces is not allowed to be used? The Project 'architect'? – Kukeltje May 18 '17 at 13:10
  • I didn't make the rule... I just have to keep to it. – Viking May 18 '17 at 13:12
  • No it is not since is NOT Javascript only form, input or other html tags are allowed. I have seen that at it is not a possible solution here – Viking May 18 '17 at 13:21
  • Right... so there is someone in your organisation that is allowed to make your work hard/difficult? Hmmm... – Kukeltje May 18 '17 at 13:23
  • 1
    So using an `` is not allowed either? Why are you using JSF then? – Kukeltje May 18 '17 at 13:23
  • the whole thing is JSF with all sorts of faces includes but in this small case I need to adress the controller with pure javascript. If commandbutton were allowed I had the solution already. The prob is that I need a way to do it with out JSF here and only use JS – Viking May 18 '17 at 13:26
  • 1
    So, why not create a servlet in that case? – Jasper de Vries May 18 '17 at 13:45
  • Or use rest? Or ... But btw... Why if all of it is JSF why then _"The prob is that I need a way to do it with out JSF here and only use JS"_ why??? (and saying 'someone told me to' is not a valid answer ;-)) – Kukeltje May 18 '17 at 16:23
  • Viking, I recommend to take a step back and learn web development basics (particularly HTTP, HTML, CSS and JavaScript) before diving further in JSF. See also http://stackoverflow.com/q/1958808 You're essentially asking how to invoke a Java method on a HTTP GET request, but failed to use the correct terminology in your question. That JavaScript piece basically invokes a HTTP GET request to the server (you actually don't need JavaScript for that at all, by the way, just plain vanilla HTML was also been sufficient as in `
    `)
    – BalusC May 19 '17 at 06:24

0 Answers0