1

I am new to web programming and Spring MVC 2.5.

I am not sure about my problem is spring sprecific or web specific in general.

I have a menu.jsp and I use jsp:include to include it in all my jsp.

<ul class="menu">
    <c:url var="home" value="home.htm"/>
    <c:url var="data" value="data.htm"/>

    <li><a href="${home}" class="parent"><span>HOME</span></a></li>
    <li><a href="${data}" class="parent"><span>DATA</span></a></li>
</ul>

When I hit my app the first time and calls http://localhost:8080/myapp/home.htm, everything went fine. But when I click a link that brought me to a new url using multiactioncontroller.

@RequestMapping(value = "/epm/epmItemList.htm", method = RequestMethod.GET)
public String setupForm(Model model, HttpServletResponse response) throws IOException {

}
@RequestMapping(value = "/epm/epmdelete.htm", method = RequestMethod.GET)
public String setupForm(Model model, HttpServletResponse response) throws IOException {

}

And then I click, home again. I am getting a 404. I am not sure why, but when I check the link at my url it now it becomes: http://localhost:8080/myapp/epm/home.htm

Spring is naturally saying no handler mapping can be found since I did not configure any mapping for these. How can I fix this problem? Thanks

1 Answer 1

1

Try the following change :

<ul class="menu">
    <c:url var="home" value="/home.htm"/>
    <c:url var="data" value="/data.htm"/>

    <li><a href="${home}" class="parent"><span>HOME</span></a></li>
    <li><a href="${data}" class="parent"><span>DATA</span></a></li>
</ul>

This way the links should be relative to your context and not relative to the local page.

Sign up to request clarification or add additional context in comments.

1 Comment

@Mark Estrada, consider upvoting the answer because you found it to be correct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.