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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:27:12+00:00 2026-05-20T18:27:12+00:00

I am building a web app using Spring MVC and I am having a

  • 0

I am building a web app using Spring MVC and I am having a problem.

Currently, if I login and go to the homepage of the webapp then it displays the user home page correctly (normal stuff profile image, details, etc) – thats all great.

However, I am trying to build in the functionality so that if anyone goes to the site with the url /user/username then it will redirect to a controller and attempt to find a user with the username “username” – if one is found then it loads the view of the selected users profile.

This is all working fine so far – but I wanted to check that if you are logged in and navigate to /user/mycurrentusername then dont load the normal profile page, just load the page you see when you first logon.. the problem is that when I return the same view I do for the homepage, being as I am now at url /user/* none of the page resources can be found (images/css) so i get the page but with no formatting/images..

What would be the best way around this? is there a better way to handle this?

(I also have problems that as it looks for images/css at /url/images.. it fires a request to my user Controller again 🙁 )

Help much appreciated!

  • 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-20T18:27:13+00:00Added an answer on May 20, 2026 at 6:27 pm

    The urls you’re creating for your stylesheets etc. should be created ideally with some sort of url rewriting tag, to ensure they’re relative to the root app context and not to the current url. What view technology are you using? JSP? If so you’ll want something like this <link rel="stylesheet" href="<c:url value='/css/styles.css'/>" type="text/css"/>. The <c:url/> tag will create a url which is effectively constant and won’t change with your current page request.

    As for your controller being hit on requests for css/images etc, check out this question. In short, ideally you want to use something like Tuckey’s Url Rewrite filter to make sure that your DispatcherServlet isn’t called for static content requests.

    Edit: Actually looks like Spring 3.04 has a nicer solution to this now than Tuckey’s Filter. <mvc:resources/> looks much simpler to setup.

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

Sidebar

Related Questions

My team is considering building our next web app using the ASP.NET MVC framework.
I'm building a MVC web application (using the Spring MVC framework), and I'm a
I'm building a webapp using spring MVC and am curious as to whether there
I am building a new web app and I am using Spring, JPA/Hibernate, and
I'm currently building a web-app that has one section where the user sees a
I'm building an MVC app for the first time. Currently, my app presents a
I'm building a web application with Grails, using the Acegi/Spring Security plugin. I want
I am building a facebook platform web app using GWT and hosting it on
I am building a ASP.NET MVC 2.0 app on .NET 4.0 and am using
I'm building a Spring web app and up until now all of my testing

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.