• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

RequestDispatcher forward not displaying jsp page  RSS feed

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Displaying/Forwarding to a jsp page from my servlet like this works fine:

  RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/test.jsp");
        dispatcher.forward(request, response);
}


Displaying/Forwarding to a jsp page from my servlet like this DOES NOT WORK, with no errors or info:
    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/test.jsp");
        dispatcher.forward(request, response);
}


Why can't tomcat7 'access' this page from the server side?
TIA!
 
Saloon Keeper
Posts: 2406
296
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where is  your JSP file located?
Have you checked Tomcat's logs?

I tried what you described and it worked as-expected for me.

ShowTestPage.java:
WEB-INF/test.jsp:
Browser:



logs/localhost_access_log.2019-02-16.txt:

 
Kieth Lyman
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the reply.  I am getting a blank screen when the servlet calls the jsp page under /WEB-INF/
Screen-Shot-2019-02-16-at-6.38.04-PM.png
[Thumbnail for Screen-Shot-2019-02-16-at-6.38.04-PM.png]
 
Ron McLeod
Saloon Keeper
Posts: 2406
296
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anything interesting in the various Tomcat logs?
 
Ron McLeod
Saloon Keeper
Posts: 2406
296
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, why port 8081?  Are you running multiple instances of Tomcat?
 
Kieth Lyman
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I do have another app running on 8080.
This is from the localhost_access_log:
0:0:0:0:0:0:0:1 - - [17/Feb/2019:03:17:46 -0500] "GET /10xsalesperf/ HTTP/1.1" 200 1345
0:0:0:0:0:0:0:1 - - [17/Feb/2019:03:17:46 -0500] "GET /10xsalesperf/css/bootstrap.min.css HTTP/1.1" 200 24576
0:0:0:0:0:0:0:1 - - [17/Feb/2019:03:17:46 -0500] "GET /10xsalesperf/css/misc.css HTTP/1.1" 200 1971
0:0:0:0:0:0:0:1 - - [17/Feb/2019:03:17:46 -0500] "GET /favicon.ico HTTP/1.1" 404 973
0:0:0:0:0:0:0:1 - - [17/Feb/2019:03:17:50 -0500] "POST /10xsalesperf/GetLoginServlet HTTP/1.1" 200 -

Thanks for any thoughts you might have on this...I'm really pulling my hair out on this one.
 
Kieth Lyman
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here are the response headers:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=UTF-8
Content-Length: 0
Date: Sun, 17 Feb 2019 08:29:22 GMT
 
Kieth Lyman
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also...this is a simple jsp/servlet/annotation application with Java7 running on Tomcat7
 
Oh, sure, you could do that. Or you could eat some pie. While reading this tiny ad:
Become a Java guru with IntelliJ IDEA
https://www.jetbrains.com/idea/
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!