Reputation: 693
I am new developing a web app using spring and jsp. Currently I have one jsp file i.e index.jsp. Now i want to create one more .jsp file and link them. I have created jsp file and added the code.
But while running , the second file is throwing error that, resource for second file not found. I am just confused whether I need to add any controller information for the second file?
My code:
<a href="<c:url value="content.jsp"/>">
<li style="background-color: #3f91bd;"><%=rs2.getString("FORM_NAME")%></li>
</a>
Can any one tell me about this? Thanks in advance.
Upvotes: 1
Views: 1319
Reputation: 232
if you are using a spring-mvc
then you don't call jsp page
directly.
You have to map jsp in controller request mapping. See example
fisrt mapping
@RequestMapping(value = "/", method = RequestMethod.GET)
public String login() {
return "index";
}
second mapping
@RequestMapping(value = "/other-page-link", method = RequestMethod.GET)
public String linkpage() {
return "other-jsp";
}
you have to jsp page i.e. index.jsp
and other-jsp
<a href="<c:url value="/other-page-link"/>">
<li style="background-color: #3f91bd;"><%=rs2.getString("FORM_NAME")%></li>
</a>
Hope my explanation is work for you if you have any doubt then we can discuss.
Upvotes: 4