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 218233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:43:53+00:00 2026-05-11T18:43:53+00:00

I have a JSP struts application that uses Spring to integrate with the services/dao/database.

  • 0

I have a JSP struts application that uses Spring to integrate with the services/dao/database. Basically, struts uses spring to get the data from the DB, it builds the form and forward them to the JSP files.

I have a header file that is injected in each JSP file using Tiles. I would like to show “Welcome John Doe” on each page inside the header. Where “John Doe” is the name of the currently logged user.

What would be the best approach to do that? The solution that I can think of is:

  1. Use a Spring Filter the catch the http request. Load the user from the database using a cookie that contains the user id(*) and put the name in a session bean named “CurrentUser”

  2. In “header.jsp”, get the spring application context. Using it, load the bean “CurrentUser” and get the name. Put the name in the html.

I think I could get this to work. But I’m not certain this is the best way to do it. Any thought on my approach?


(*) Of course, the cookie will be encrypted

  • 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-11T18:43:53+00:00Added an answer on May 11, 2026 at 6:43 pm

    Although it may be an extremely large hammer for your fairly simple use-case, we have gotten a really neat spring-jsp integration (jsp 2.1 required!) by using ELResolver. By following this tutorial you can basically inject any spring managed bean into your el-context and allow it to be accessed using jsp-el like this:

    ${spring.mybean.myproperty}

    You can choose to inject pre-defined beans into your el-context or simply pass “mybean” to getBean and allow almost anything spring-managed to be accessible from jsp. mybean could easily be a session-scoped spring bean.

    I’m not totally sure how this would align with tiles, though.

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

Sidebar

Ask A Question

Stats

  • Questions 204k
  • Answers 204k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It sounds like the best option for you would be… May 12, 2026 at 8:46 pm
  • Editorial Team
    Editorial Team added an answer It must be named setUp, starting with a lowercase s. May 12, 2026 at 8:46 pm
  • Editorial Team
    Editorial Team added an answer Found it. Add MyCollectionViewSource.View.Refresh() to a method that changes the… May 12, 2026 at 8:46 pm

Related Questions

I have a legacy Struts 1.2.8 application that I'm maintaining and porting from Oracle
I have heard that you can run an ASP.NET application and ASP.NET mvc application
I am working on a basic Struts based application that is experience major spikes
One of the projects I was in charge of as a JSP/Struts developer at

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.