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

  • SEARCH
  • Home
  • 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 183679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:09:31+00:00 2026-05-11T15:09:31+00:00

Once more here I come with a question of s2, I’m a beginner at

  • 0

Once more here I come with a question of s2, I’m a beginner at it and got some trouble finding examples.

I’m building a menu service which depends upon a login, which is give when the user enters at start page. Once the login has been made, I store the user object into the session by doing the follow:

@Override public String intercept(ActionInvocation invocation) throws Exception { ....           // verifica se o parametro do CPF veio no get e tenta logar o usuario if (!StringUtils.isBlank(request.getParameter(USER_CPF_REQUEST))) {  if ( doLogin(request, session) ) {    return Action.SUCCESS; } 

and then the doLogin method

Usuario usuario = getServico().buscar( Long.valueOf(cpf) ); //Caso o usuário exista, guarda na session if (usuario != null){     session.setAttribute(USER_HANDLE, usuario);     return true; } 

Now comes the problem, I have a MenuBean injected on the MenuAction by the following xml piece on ApplicationContext.xml

<bean id="menuService" class="br.com.autenticis.renacon.ejb.MenuBean" />      <bean id="menuAction" scope="prototype" class="br.com.autenticis.renacon.actions.MenuAction">         <constructor-arg ref="menuService" />     </bean> 

And the menuAction is declared as follow:

public class MenuAction extends ActionSupport implements Preparable, SessionAware 

By doing so I need to implement the session set with a private member

private Map<String, Object> session; .... @Override public void setSession(Map<String, Object> session) {    this.session = session; } 

The failing part of all its the method bellow, the session object is null at debugging:

    public String execute() {             if ( session.containsKey( LoginInterceptor.USER_HANDLE) ){                 Usuario u = (Usuario) session.get( LoginInterceptor.USER_HANDLE);                 setMenu( servico.getMenuPerfil( u.getPerfil() ) );                 return Action.SUCCESS;             }                          return input();         } 

Does anyone know why? or how to implement it? Looking at the code above, I need ‘Perfil’ from the user which is logged on, if the session contains the key to the user object I get it and then use the perfil to populate the Menu through the setter and return SUCESS, otherwise it’ll return INPUT which will lead to the login screen.

  • 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. 2026-05-11T15:09:32+00:00Added an answer on May 11, 2026 at 3:09 pm

    After some ours I managed to discover the error. wich lies not in the program but in the struts.xml, I’ve written a custom stack for the application:

    <!-- stack seguro -->  <!--  <interceptor-stack name='defaultLoginStack'>  <interceptor-ref name='logger' />  <interceptor-ref name='params' />  <interceptor-ref name='login' />  <interceptor-ref name='prepare' />  <interceptor-ref name='chain' />  <interceptor-ref name='modelDriven' />  <interceptor-ref name='modelDriven' />  <interceptor-ref name='fileUpload' />  <interceptor-ref name='staticParams' />  <interceptor-ref name='params' />  <interceptor-ref name='conversionError' />  <interceptor-ref name='validation' />  <interceptor-ref name='workflow' />  </interceptor-stack>  -->  

    And somewhat forgot to include session-related items, with the defaultLoginStack changed to

    <interceptor-stack name='defaultLoginStack'>  <interceptor-ref name='login' />  <interceptor-ref name='defaultStack' />  </interceptor-stack>   

    I’m now able to use session injected correctly.

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

Sidebar

Related Questions

I succesfully used a validator more than once,but after some programming my validators are
I have some Kind of Question about FFT (Actually I believe it's more about
Through the years I've come across this scenario more than once. You have a
Buried in mySQL syntax and query structure problems once more. I'm currently doing this
First of all, pardon me for bringing up this hugely discussed issue once more
When a Thread is finished, you cannot run it once more, using start() method:
Page_Load Calls more than once (4 times in my case) in FireFox but in
I thought that calling BeginInvoke more than once on the same delegate instance would
I was told more than once that Delphi handles dynamic classes better than static.Thereby
webview in android loads more than once while loading the url. Below is the

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.