Reputation: 113
I want to redirect JSP page from one servlet. All JSP pages are under WebContent/resources/jsp/en/ and all css, js, images are under webcontent/resources/**I have a problem of calling that JSP pages. I got **404 errors
I can access css js and images using
<%=request.getContextPath()%>/resources/css/styles.css
but not jsp pages....what I am doing is
servlet:
String url = request.getServletPath();
if (url.equals("contactUs")) {
System.out.println(request.getContextPath()+"..............");
request.getRequestDispatcher("/resources/jsp/en/contactUs.jsp").forward(request, response);
}
web.xml:
<url-pattern>/portal/*</url-pattern>
this is not working ...
Upvotes: 1
Views: 1552
Reputation: 5023
Concat request.getContextPath()
with /resources/jsp/en/contactUs.jsp
.
request.getRequestDispatcher(request.getContextPath()+"/resources/jsp/en/contactUs.jsp")
.forward(request, response);
Upvotes: 2