Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 984857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:04:45+00:00 2026-05-16T05:04:45+00:00

I have a problem with my facelets: I constricted a nav part that displays

  • 0

I have a problem with my facelets:

I constricted a nav part that displays login information for about curren user and a logout button. Login works properly. But after a user logs out, the nav part of my page displays

Welcome, User (role)    [Logout_Button]

Whereas, what I want is the same thing that happens when you get to the login the first time:

Welcome, Guest

(Thank you Java drinker for those easy words :-))

Here you can see part of my template:

  <div id="metaContainer">
        <ui:include src="/metaMenu.xhtml" />
  </div>

That’s my nav part with login info (called metaMenu.xhtml):

    <ui:composition xmlns="http://www.w3.org/1999/xhtml" lang="en"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core">
    <div id="login_info">
        <h:outputLabel value="Willkommen, "/>
        <h:outputLabel class="principal" value="#{metaNavData.principal}"/>
        <h:outputLabel value="#{metaNavData.role}"/>
    </div>
    <div id="meta_nav">
        <h:form name="loginform" rendered="#{authorisation.authenticated}">
        <h:commandLink action="#{loginController.logout}" rendered="#{authorisation.authenticated}">
        Logout</h:commandLink>
        </h:form>
    </div>
</ui:composition>

As BalusC and Java Drinker assumed it could be a java logic problem. I first need to say, that I use Apache Shiro for security issues. So here is the relevant Java code:

my loginController that contains the logout method:

@ManagedBean
@SessionScoped //Mistake!!! That should be RequestScoped, see below
public class LoginController {

private Subject currentUser;  // import org.apache.shiro.subject.*;

public LoginController() {
    currentUser = SecurityUtils.getSubject();
}

public String logout() {
    if (currentUser.isAuthenticated()) {
    currentUser.logout();
    }
    return "welcome.xhtml";
}

And her you can see my backed bean ‘authorisation’, which is supposed to provide information that can be used to hide comonents like the loginbutton:

@ManagedBean
@RequestScoped
public class Authorisation {

    private Subject currentUser;

    public Authorisation(){
        currentUser = SecurityUtils.getSubject();
    }

    public boolean getAuthenticated(){
        return currentUser.isAuthenticated();
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:04:45+00:00Added an answer on May 16, 2026 at 5:04 am

    Ok, so from what I understand, your problem is that even after a user logs out, the nav part of your page displays

    Welcome, User (role)    [Logout_Button]
    

    Whereas, what you want is the same thing that happens when you get to the login the first time:

    Welcome, Guest
    

    The problem, I think, is in your log out functionality. For whatever reason, even after you logout, #{authorisation.authenticated} is returning true. Secondly, #{loginController.principal} still contains the value of the previously logged in user, and his/her role. Are any of these beans session scoped perhaps, or caching the value somewhere?

    And BalusC is right (as usual) in that you are using the word rendered here incorrectly. The button is the only element that is conditionally rendered. From what I see, the Welcome, User(role), vs Welcome, Guest is based solely on the value in the loginController.

    If you can post some of your java code for those beans and login/logout functionality, we can try to help further

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem in some JavaScript that I am writing where the Switch statement
i have a strange problem. I have an ICEFaces(1.8.2) + Facelets application im working
I am learning facelets and Seam and I'm facing the following problem: I have
I have a JSF 1.2 application (Sun RI, Facelets, Richfaces) that was used only
I have a new web app that is packaged as a WAR as part
I have problem with return statment >.< I want to store all magazine names
I have problem with starting processes in impersonated context in ASP.NET 2.0. I am
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have problem with ActionLink. I'd like to pass to my ActionLink parameter for
I have problem when I try insert some data to Informix TEXT column via

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.