I’m trying to do simple navigation between two pages, but an error appears and i can not solve it
firt page is my home.jsp here i make a link
<a href="/timecard/NewAccount"><FONT COLOR="#40C0FF">Create New Account</FONT></a>
then i make accounts folder i witch i have to files createAccount.jsp – this is my target page, and views.xml whit this source
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN" "http://tiles.apache.org/dtds/tiles-config_2_1.dtd">
<tiles-definitions>
<definition extends="default" name="createNew">
<put-attribute name="body" value="/WEB-INF/views/accounts/createAccount.jsp"/>
</definition>
</tiles-definitions>
And my AccountsController
@Controller
@RequestMapping(value="/timecard/newAccounts")
public class AccountsController {
@RequestMapping(method=RequestMethod.GET)
public String accountForm(Model model){
return "createNew";
}
}
So when i click the link in home.jsp the page is not found and this is the message
WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/timecard/NewAccount] in DispatcherServlet with name 'appServlet'
i’m really confused. can you tell me what i’m doing wrong.
thanks in advance
You are using wrong url in href tag. In your controller you have mapped url
/timecard/newAccounts.So you need to change the href to
${pageContext.servletContext.contextPath}/timecard/newAccountsand then try again.Hope this helps you. Cheers.