You could use logic like the following (from the default menu.jsp):

<menu:useMenuDisplayer name="Velocity" config="cssHorizontalMenu.vm"
permissions="rolesAdapter">
<ul id="primary-nav" class="menuList">
    <li class="pad">&nbsp;</li>
    <c:if test="${empty pageContext.request.remoteUser}"><li><a href="<c:url
value="/login.jsp"/>" class="current"><fmt:message
key="login.title"/></a></li></c:if>
    <menu:displayMenu name="MainMenu"/>
    <menu:displayMenu name="UserMenu"/>
    <menu:displayMenu name="AdminMenu"/>
    <menu:displayMenu name="Logout"/>
</ul>
</menu:useMenuDisplayer>

Hope this helps,

Matt

On Tue, Jul 20, 2010 at 4:00 AM, Kissue Kissue <kissue...@gmail.com> wrote:

> Hi Folks,
>
> In my appfuse application, i have a home page that a user sees before going
> to the login page. Basically, i am required to add a link on the home page
> menu that directs to the login page. All the other links on the home page
> menu are also available upon login. But i need to implement the login menu
> item in such a way that it is available when a user first visits the home
> page and after a user logs in, it should disappear.
>
> I am having problems implementing this as i have added the following in
> menu-config.xml:
>
> <Menu name="Login" title="menu.login" description="Login" page="/login.jsp"
> roles="ROLE_ANONYMOUS"/>
>
> But the login menu never appears. If i remove the roles attribute, then the
> menu appears even after login. I suspect its because, struts menu does
> request.isUserInRole() to check if user has required role but then at this
> point user is not logged in so the method call returns false.
>
> I have also added the following in security.xml:
>
> <anonymous granted-authority="ROLE_ANONYMOUS"/>
>
> but this dosent seem to have solved the problem. Has anybody ever
> encountered this? Is there a way i can get Struts menu to also check for
> annoymous users?
>
> Any help would be appreciated.
>
> Thanks.
>

Reply via email to