vasudha Jha
vasudha Jha

Reputation: 1

The origin server did not find a current representation for the target resource or is not ... error when running jsp page

I am trying to run this code in my Eclipse JSP dynamic web page. But on running it in the Tomcat Server Version 9.0, I am getting an error 404 message. Error Message-The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. I was trying to include a header page in my other jsp page in this code.

So far I have tried switching the location of the server via server properties. I have also checked the Use Tomcat installation checkbox in Server Locations. Still, I am getting this error.

  <!DOCTYPE html>
  <html>
  <head>
  <title>Insert title here</title>
  </head>
  <body>
  <jsp:forward page="http://localhost:8080/HelloJSP/HeaderPage.jsp" /> 
  </body>
  </html>

Upvotes: 0

Views: 3017

Answers (2)

vasudha Jha
vasudha Jha

Reputation: 1

Thank You for your help :) Actually, this problem was solved once I removed all the server from eclipse and switched it off. Then I readded the sever once again and it started working. Still not able to find the reason this error was caused but it was fixed by using the above method.

Upvotes: 0

Jin Lee
Jin Lee

Reputation: 3512

If the page is under WEB-INF folder, an 404 error message might appear. I had the similar problem.

I put the pages under the WebContent folder instead. In Eclipse, the location of files may look confusing. Sometimes right click the file and look at their properties for paths. Just like below :

enter image description here

As you can see, even though pages look like they are under WEB-INF, they are under WebContent. Then, you won't see 404. And you can put the url to see your page in your browser.

If this doesn't help, then check your Web Project Settings.

enter image description here

Right-click your project, go to Properties, and find Web Project Settings.

Can you see my Context root "/" ? If I want to run my jquery.html page, I just type

localhost:8080/jquery.html

enter image description here

If you change your context root to "test", then you type :

localhost:8080/test/jquery.html

enter image description here

enter image description here

Don't forget to clean your Tomcat after changing your context root. Otherwise, it won't apply changes.

enter image description here

Upvotes: 1

Related Questions