jolenzy
jolenzy

Reputation: 37

Change page name in Tapestry

I'm beginner with Tapestry. I have a component called Navigation, where I dynamically get the pageName of my web pages, and display the link in header of a website. Here's the relevant part:

<t:loop source="pages" value="row">
            <li><t:pagelink t:page="${page}">${pageName}</t:pagelink></li>
</t:loop>

That works ok.

I have page About_us.tml, and About_us.java. That page contains only text, so it's simple. My problem is, that my Navigation component displays this page in header (where are links to all of the pages of my web app) as About_us link. I want to change this to About us link. I don't want the "_" sign.

Any idea how could I possibly solve this?

Thanks.

Upvotes: 0

Views: 206

Answers (1)

Howard M. Lewis Ship
Howard M. Lewis Ship

Reputation: 549

It's very easy to pass the pageName through a bit of Java code to prepare it to be presented.

public String prepare(String pageName) { return pageName.replace("_", " "); }

and

<t:pagelink ...>${prepare(pageName)}</t:pagelink>

Upvotes: 1

Related Questions