I need to make the url be the title of the movie that I return from the database. mywebsite.com/movie_name
The problem is it keeps looping infinitely and never displays my page index.jsp
I know it wouldn't because I need to specify it somewhere but I dont know where. I tried
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("index.jsp/"+movieName)
but that doesnt work either it keep looping. plus I don't want my url to have 'index.jsp' int it
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
String movieName="movie";
try {
movieName = putMovieInSession(request);
} catch (Exception e) {
throw new ServletException(e);
}
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/"+movieName);
dispatcher.forward(request, response);
}
<servlet>
<servlet-name>movie</servlet-name>
<servlet-class>package.MovietServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>movie</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
...