• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Query on CommandLink's javascript conversion

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Tim :)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic