There is a starting page ( index.jsp ) which is a menu and links from it lead to jsp files that are in WEB-INF . But when I use the <a href="addition.jsp">Добавить пользователя</a> I get a 404 error. Previously, I had all the files right in the webapp and they could be accessed just by building the URL but now I got the task to ensure security by placing all jsp files in WEB-INF . And internal navigation links no longer work.
Please help me, how can I ensure the transition to the page that lies in WEB-INF ?
So I drop my index.jsp and addition.jsp to which I should get via the link <a href="addition.jsp"> which is on the index.jsp page:
<!--Homepage.--> <servlet> <servlet-name>HomePageServlet</servlet-name> <servlet-class>ru.pravvich.servlets.HomePageServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>HomePageServlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <!--Add user in database.--> <servlet> <servlet-name>AddUserServlet</servlet-name> <servlet-class>ru.pravvich.servlets.AddUserServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>AddUserServlet</servlet-name> <url-pattern>/addition</url-pattern> </servlet-mapping> This is the servlet that gives index.jsp:
public class HomePageServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("UTF8"); req.getRequestDispatcher("/WEB-INF/views/index.jsp").forward(req,resp); } } And my index.jsp
<body> <h2>Меню</h2><br /> <ul> <li><a href="addition.jsp">Добавить пользователя</a></li> </ul> </body> How can this be done without crutches? Thank.