• Post Reply Bookmark Topic Watch Topic
  • New Topic

Query on CommandLink's javascript conversion  RSS feed

 
kevin redd
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose that the CommandLink component is used in the following way to submit the h:form:-

<h:commandLink id="animalCommandLink" value="submit" action="show"/>

When the page is loaded in the browser(Mozilla) I can see its JAVASCRIPT and <a> tag, in the page source as follows:-

<script type="text/javascript" src="/AnimalWeb/javax.faces.resource/jsf.js.xhtml?ln=javax.faces&stage=Development"></script>
<a id="animalCommandLink" href="#" onclick="mojarra.jsfcljs(document.getElementById('j_idt5'),{'animalCommandLink':'animalCommandLink'},'');return false">submit</a></td>

============================

My Query is that, though I have specified a navigation in CommandLink as 'action="show"' why does the populated pagesource show 'href="#"' ? Shouldn't it show 'href="show.xhtml"' ?

Is there any specific reason for the show.xhtml not being populated? Or is it for some security reason to hide the page nevigation from the END user?

Thanks in advance.
 
Tim Holloway
Bartender
Posts: 18715
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's becausee JSF doesn't do direct client-side navigation via html links. It's submitting a form, and the metadata within the form is used by the FacesServlet to do the actual navigation. And although the rendered tag looks pretty cryptic, JSF does know how to handle it properly.

Which is actually to "show.jsf", not "show.xhtml". JSF works on URLs, not on resources such as .xhtml. The resources are used to do the URL processing.
 
kevin redd
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Tim :)
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!