Why facelets ignore href-attribute of a link when I use <a href="url" jsfc="h:outputLink"> ?

Posted by Roman on Stack Overflow See other posts from Stack Overflow or by Roman
Published on 2009-12-04T16:52:27Z Indexed on 2010/05/12 4:04 UTC
Read the original article Hit count: 306

Filed under:
|
|

I have next facelet composition:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
<body>
    <ui:composition>
        <ul id="navigation">
            <li>
                <a href="http://google.com" id="google1" jsfc="h:outputLink">google.com</a>
            </li>
            <li>
                <h:outputLink id="google2" value="http://google.com">
                    <h:outputText id="outputtext" value="google.com"/>
                </h:outputLink>
            </li>
        </ul>
    </ui:composition>
</body>
</html>

There must be a mistake because what I expected to see is almost the same final html-markup. But actually here is what facelets generated:

<ul id="navigation"> 
    <li><a id="google1" name="google1" href="">google.com</a></li> 
    <li><a id="google2" name="google2" href="http://google.com"><span id="outputtext">google.com</span></a> 
    </li> 
</ul>

Why it ignored href attribute of the first link? What is the correct way to do what I'm trying to do?


One more additional question: if I'm using jsfc everywhere I can then what should I do with components from f: namespace? Where should be <f:view> placed? Maybe in the template.xhtml? Or I should simply ignore it?

© Stack Overflow or respective owner

Related posts about jsf

Related posts about facelets