This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Stock up on JSP 404 error. JSP could not be located.  RSS feed

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I could not see the error on this problem... Why it could not locate my jsp? I am using NET Beans IDE and TOMCAT 7.012


http://localhost:8080/Beer-v3/WEB-INF/jsp/result.jsp

HTTP Status 404 - /Beer-v3/ result.jsp

type Status report

message /Beer-v3/ result.jsp

description The requested resource (/Beer-v3/ result.jsp ) is not available.
Apache Tomcat/7.0.12


here is the servlet:



My JSP







 
Author and ninkuma
Marshal
Posts: 66804
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

victor chiong wrote:http://localhost:8080/Beer-v3/WEB-INF/jsp/result.jsp


You cannot access a resource under WEB-INF via URL.

RequestDispatcher view = request.getRequestDispatcher(" result.jsp ");


What's with the spaces?
 
victor chiong
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

So where should i place it?

Index.jsp is found on WEB-INF/JSP so I place my result.jsp there. So where should i place it? The spaces is what i am doing to see if my jsp will be found or not. spaces or no spaces, it could not found my result jsp.

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66804
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

victor chiong wrote:So where should i place it?


Having it under WEB-INF is fine as long as you are forwarding to it from a servlet. But you cannot access it directly without the servlet -- which is usually exactly what you want.

The spaces is what i am doing to see if my jsp will be found or not. spaces or no spaces, it could not found my result jsp.


No spaces. But you need to include the path to the JSP. Otherwise how would its location be known?
 
victor chiong
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Something like I am super new to this... sorry for the question...

RequestDispatcher view = request.getRequestDispatcher("WEB-INF/JSP/result.jsp "); ?

Thanks,
Vic
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66804
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Need the leading slash, and no space!
 
victor chiong
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Still the same....

HTTP Status 404 - /Beer-v3/WEB-INF/JSP/result.jsp

type Status report

message /Beer-v3/WEB-INF/JSP/result.jsp

description The requested resource (/Beer-v3/WEB-INF/JSP/result.jsp) is not available.
Apache Tomcat/7.0.12


Inside of the doPost Method..


String c = request.getParameter("color");
BeerExpert be = new BeerExpert();
List result = be.getBrands(c);


request.setAttribute("styles", result);

RequestDispatcher view = request.getRequestDispatcher("/WEB-INF/JSP/result.jsp");

view.forward(request, response);





 
victor chiong
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I had solve the problem...

I transfered result.jsp to the main folder from Web pages/WEB-INF/JSP to Web pages/result.jsp. the problem with that is that I think it is better to place it in JSP folder? But how would you do it?

RequestDispatcher view = request.getRequestDispatcher("/Web Pages/WEB-INF/jsp/result.jsp");
RequestDispatcher view = request.getRequestDispatcher("/WEB-INF/jsp/result.jsp");

code above does not work....

regards,
Vic
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!