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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:37:37+00:00 2026-06-14T14:37:37+00:00

I am have the following configuration for my Spring MVC + Apache tile 2

  • 0

I am have the following configuration for my Spring MVC + Apache tile 2 project.

The Tile configuration

<definition name="test1" extends="mymain">
    <put-attribute name="main">
        <definition template="/WEB-INF/views/tiles/template/generictemplate.jsp">
            <put-attribute name="headerstyle" value="./resources/css/header.css" type="string" /> 
            <put-attribute name="genericcontent" value="/WEB-INF/views/tiles/test.jsp" />                 
        </definition>
    </put-attribute>
</definition>
<definition name="test2" extends="mymain">
    <put-attribute name="main">
        <definition template="/WEB-INF/views/tiles/template/generictemplate.jsp">
            <put-attribute name="headerstyle" value="./resources/css/header.css" type="string" /> 
            <put-attribute name="genericcontent" value="/WEB-INF/views/tiles/test.jsp" />                 
        </definition>
    </put-attribute>
</definition>

The controller

@RequestMapping(value="/test1", method=RequestMethod.GET)
    public String test1(@RequestParam(value="id", required=true) String id){
        return "test1";
    }
@RequestMapping(value="/test2", method=RequestMethod.GET)
    public String test2(){
        return "test2";
}

The view generictemplate.jsp

<%@ include file="include.jsp" %>
<tiles:importAttribute name="headerstyle" />
<link href="${headerstyle}" rel="stylesheet" type="text/css" />

<div role="main" class="main clearfix">
        <section class="generic">
            <div class="post">
                <tiles:insertAttribute name="genericcontent"/>
            </div>
        </section>
    <!-- end main -->
</div>

My problem is
When i am calling test2 (without parameter), the header.css can be read. But when test1 is called, I am getting 404 Not Found for header.css. I noticed that view is trying to access the css with path of

http://localhost:8080/myproject/test1/resources/css/header.css

instead of

http://localhost:8080/myproject/resources/css/header.css

when test1 is calling.
So why the @RequestParam makes this difference?

Thank.

  • 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-06-14T14:37:41+00:00Added an answer on June 14, 2026 at 2:37 pm

    This is because the css is being loaded relative to the current URL.
    For test1 you have a param which adds a slash after test1. Where as test2 doesn’t have the param, so its relative to the parent directory.

    You could try using absolute paths for the css.

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

Sidebar

Related Questions

I have the following log4j.xml configuration: <log4j:configuration> <appender name = CONSOLE class = org.apache.log4j.ConsoleAppender>
I have the following spring configuration: <context:component-scan base-package=uk.co.mysite.googlecontactsync.aop/> <bean name=simpleEmailSender class=uk.co.mysite.util.email.simple.SimpleEmailSenderImplementation/> <aop:aspectj-autoproxy/> Then I
I have the following text: started: Project: ProjectA, Configuration: Release Any CPU ------ I
I have following situation: I use Struts2 as MVC cobtroller I use Spring as
I have been trying to integrate Spring (3.0.4 and 3.0.5) MVC with Apache Tiles
I am using Spring MVC, and in the configuration I am using the following
I have the following spring security configuration: <security:http> ...... <security:intercept-url pattern=/auth/** access=ROLE_ADMIN/> ......... </security:http>
Say I have an application with the following structure. // ASP.NET MVC (Web Project)
The following is a snippet from a project based on Spring web MVC 3.1.1.
I have the following configuration for PHPMailer, which worked perfectly on my localhost machine,

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.