href - commandlink in JSF not generating the intented HTML tag -


i'm trying call managed bean h:commandlink in jsf. don't see href attribute in rendered html a tag.

am missing ?

there managedbean called accountsetupcontroller signup method in it.

this tag used in jsf:

  <h:form prependid="false">     <h:commandlink  action="#{accountsetupcontroller.signup()}"           value="#{msg['homepage.createaccount']}" styleclass="button large">     </h:commandlink>   </h:form> 

this rendered tag. see there nothing in href attribute.

 <a href="#" onclick="mojarra.jsfcljs(document.getelementbyid('j_idt15'),   {'j_idt33':'j_idt33'},'');return false"    class="button large">create account</a> 

this form tag generated

    <form id="j_idt15" name="j_idt15"      method="post" action="/myproject/faces/homepage/homepage.xhtml"      enctype="application/x-www-form-urlencoded">       .... </form> 

as can see, form action pointing place don't need.

am missing ?

command links in jsf rendered way. form submitted jsf via javascript's onclick method using jsf js library, while href stay #.

moreover, won't find bound action / action listener method names in browser tools due understandable reasons. rather, jsf find id of clicked link on server , trigger of component's action(listeners).

all in all, reading <h:commandlink> documentation unsurprisingly helps lot (all emphasis mine):

general behavior: both encode , decode behavior require ability id/name hidden field, may rendered in markup or may programmatically added via client dom manipulation, value set javascript form submit (further referred hiddenfieldname.

decode behavior: obtain "clientid" property of component. obtain map "requestparametermap" property of externalcontext. derive hiddenfieldname above. entry in map under key hiddenfieldname. if there no entry, or entry empty string, or entry not equal value of "clientid" property, return immediately. if there entry, , value equal value of "clientid" property, create new javax.faces.event.actionevent instance around component , call queueactionevent() on component, passing event.

encode behavior: render "#" value of "href" attribute. render current value of component link text if specified. render javascript functionally equivalent following value of "onclick" attribute: document.forms['client_id']['hiddenfieldname'].value='client_id'; ocument.forms['client_id']['param1_name'].value='param1_value'; document.forms['client_id']['param2_name'].value='param2_value'; return false; document.forms['client_id'].submit()" hiddenfieldname described above, client_id clientid of uicommand component, param*_name , param*_value names , values, respectively, of nested uiparameter children.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -