tags:

views:

250

answers:

1

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"&gt;
<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"&gt;
<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"&gt;
                    <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"&gt;&lt;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?

+1  A: 

Might be a bug in facelets. Besides, why don't you just omit that attribute? simple <a href suits you.

Bozho
hm.. as I understand h:commandLink works with some javascript, but I want normal link. I thought that h:outputLink is a standart way in jsf to make simple standard html-link.
Roman
I mean that generated html-markup for second link (h:outputLink) is what I really want. But I want to achieve this with jsfc-attribute.
Roman
why exactly do you want the jsfc attribute?
Bozho
hm.. actually I want to write 'nice' code, but I don't understand yet what is a nice code with facelets. I thought that we should use jsfc where it's possible. About simple "a href" - that's ok, but why then we need h:outputLink component?
Roman
Because it is a component. You can bind it, you can set its 'rendered' attribute, it is present in the component tree. But you need a simple link to a fixed location - use <a :)
Bozho