The className property will return the currentPage className for the html tags when the pagename matches the current node we render

import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;

public class MenuItem  {
    @Property @Parameter(required = true, allowNull = false, defaultPrefix = BindingConstants.LITERAL)
    private String page;
    @Property @Parameter(required = false, allowNull = true, defaultPrefix = BindingConstants.LITERAL)
    private boolean isPage = true;
    private Messages messages;

        private ComponentResources resources;
    public String getPageTitle() {
        String key = page + "-title";           
        return messages.get(key);
    public String getClassName() {
                if (resources.getPageName().equalsIgnoreCase(page)) {
                        return "selected";
        return null;

<li xmlns:t="" xmlns:p="tapestry:parameter">
        <t:if test="isPage">
                <t:pageLink page="${page}" class="${className}">${pageTitle}</t:pageLink>
                <a href="#" class="${className}">${pageTitle}</a>

Tapestry5LayoutWithMenuMenuItem (last edited 2009-10-20 18:12:02 by outbound)