You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by J T <fu...@gmail.com> on 2006/02/09 00:00:46 UTC

How to indicate current page to the user

I have a struts/tiles app that has a navigation pane which renders
navbar.jsp. My user would like the current page to be highlighted in bold.
So for example if the user is on page two the navbar would look like this:

page1
<span style=mybold>page2</span>
page3
page4
...

This is similar to breadcrumb like functionality (there are many breadcrumb
threads on the list) but I don't need the user to know
where they came from just where they are.

My current thought is to extend TilesRequestProcessor and do something like
this

protected ActionForward processActionPerform(...) {
    request.getSession().setAttribute("CURRENTPAGE",mapping.getPath());
}

and then in navbar.jsp

<%
String curpage = (String)request.getSession().getAttribute("CURRENTPAGE");
if (curpage.equals("/page1")) {
%>
    <span style=mybold><html:link action="/page1">Page1</html:link></span>
<%
} else {
%>
    // do standard
    <html:link action="/page1">Page1</html:link>
}%>
...
and so on for the rest of my pages.

I think this will work but it seems like it is too tightly bound and too
much work to maintain.

Is there a better way?