java - Jsp 404 exception -
i know question asked many times, looked through answers found, tried many things, didnt success. tell me if searches not enough)
so, i'm dealing java, spring , jsp server pages. in webapp folder has index.jsp , want have possibility jump index page jsp, located in webapp/web-inf/pages/. wrote in mvc-dispatcher-servlet.xml (located in web-inf) code:
<bean class="org.springframework.web.servlet.view.internalresourceviewresolver"> <property name="prefix" value="/web-inf/pages/"/> <property name="suffix" value=".jsp"/> </bean> index.jsp looks this:
<%@ page contenttype="text/html;charset=utf-8" language="java" %> <html> <head> <title>tables</title> </head> <body> ... <br/> <a href="adminmain" target="_blank">admin main page</a> <br/> <a href="usermain" target="_blank">user main page</a> </body> </html> running program, i'm expecting when press link "admin main page", i'll jump webapp/web-inf/pages/adminmain.jsp, instead have 404 error (page not found). tell me things went wrong, please!
you need map .jsp endpoint can browse through spring @controller:
@controller public class mycontroller { @getmapping("/adminmain") public string adminpage() { return "adminmain"; } } have @ spring mvc documentation on this: https://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-controller
Comments
Post a Comment