struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joseph Toth" <>
Subject How to get requested URL with tiles
Date Fri, 20 Feb 2004 21:09:21 GMT
Using titles to setup a website, I would like to know how I can get the
requested URL in a JSP page.
Simply my question is, how can I get the requested URL  ...
'/'  instead of the template jsp?
request.getServletPath() will just return template_sidebar.jsp, I need
to differentiate between page.
I would like to use one header for a lot of pages, the header has a
navigation bar of a couple images...
and I want to display a 'highlighted' image for when the current page
corresponding to that image is clicked.
In order to do so, I need to put code like...
if (currentpage == "RewardsView") img src="rewards_highlighted.gif" 
else img src="rewards_not_highlighted.gif"
I'm sure plenty of people have done this, and of course I would not like
to create 6 different headers, one
for each navigation item.  Any ideas?
Whenever someone goes to http://localhost/ I want to display
the highlighted gif.  This
would be easy if request.getServletPath() would return /, but
it returns /template/template_sidebar.jsp,
so I cannot differentiate between any pages that use the same template.
Is there a way to get the requested URL? Or does anyone know of a way to
differentiate between the page?
In the struts config I have...
<action path="/Rewards" type="org.apache.struts.actions.ForwardAction"
parameter="RewardsView" />

In the tiles config I have...
<!-- Titles -->
<definition name="template_sidebar"
    <put name="title" value=""/>
    <put name="header" value="/header/header_default.jsp"/>
    <put name="sidebar" value=""/>
    <put name="body" value=""/>
    <put name="footer" value="/footer/footer_default.jsp"/>
<definition name="RewardsView" extends="template_sidebar">
 <put name="title"  value="Rewards" />
    <put name="sidebar" value="/sidebar/sidebar_rewards.jsp"/>
    <put name="body" value="/body/body_rewards.jsp"/>

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message