Vetha
Vetha

Reputation: 41

Not able to run a simple JSP program in Eclipse with Tomcat server 7 in browser

I have written the following code in Eclipse, and store this file in this location: tomcat/webapps/jsp/sample.jsp.

I have also included the Sub directories WEB-INF and classes and lib in this jsp folder.

And I have given this url in the google chrome browser first time and next time in Internet Explorer both shows the 404 error with description:

The requested resource(/jsp/sample.jsp) is not available**.

My code is:

<%@ page language="java" import="java.io.*" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>Insert title here</title>
    </head>
    <body>
    hello
    </body>
</html>

Thank you sir, here are the steps;
1. Tomcat is installed in c:\Program files\Apache\tomcat 7.0\

  1. I am using Eclipse helio zip file and extracted that in c:\eclipse...

  2. Then I have followed the steps from "http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html" to set up server in eclipse.

4.Then I start the jsp file from "file->new->other->wizard->web->jsp file. Then I open the jsp file in the eclipse editor.

  1. After that I start the [tomcat7.0 server at localhost]

  2. I save the file and copy the jsp file from the eclipse workspace and paste it in the webapps folder.

these were the steps I have followed.

can you help me sir.

Upvotes: 2

Views: 7599

Answers (1)

Vetha
Vetha

Reputation: 41

I have solved my problem.

  1. First I uninstalled both Eclipse and tomcat 7 and Reinstalled it.
  2. I followed the instruction in the http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html
  3. Then I copy and paste the Root folder from Tomcat (c:\tomcat\webapps\ROOT) and paste it in the eclipse (c:\users\workspace\ .metadata\ .plugins\ org.eclipse.wst.server.core\ tmp0\ wtpwebapps\ ROOT) here we want to right click in this eclipse ROOT folder and paste it.
  4. Then follow the usual procedure to run the eclipse program. Each time I restarted the server and it now works fine.

Upvotes: 2

Related Questions