dunfa
dunfa

Reputation: 539

Old Servlet content keeps persistent in html

I am learning Servlet and JSP using Apache Tomcat. Here I have a simple Java class extending HttpServlet and put some string on HTML. It works except that the first text message is persistent even if I modified it.

package com.example.tutorial;

import java.io.*;

import javax.servlet.*;
import javax.servlet.http.*;

public class ServletExample extends HttpServlet 
{
    private static final long serialVersionUID = 1L;

    protected void service(HttpServletRequest request, HttpServletResponse response) 
            throws ServletException, IOException 
    {   
        PrintWriter out = response.getWriter();
        out.println("Hello, Java."); 
    }
}

First I saw "Hello, Java" in

http://localhost:8080/.../example 

I changed the string to "Goodbye" but still saw "Hello, Java".

I tried to restart Tomcat and Eclipse but that won't solve the problem. Is there any cache in Tomcat?

Help me out of this, please.

Upvotes: 0

Views: 95

Answers (1)

A4L
A4L

Reputation: 17595

You could try the following:

Make sure that

Project > Build Automatically

is enabled.

Make sure that auto publishing to the server you are using is enabled, for that you can proceed like this:

Go to

Window > Show View > Servers

when the Servers tab is displayed, double click on your server to open its configuration. In the drop down menu Publishing choose Automatically publish when resources change save and restart the server

right click on your server > Restart

Clean the work directory of Tomcat, on the Servers tab

right click on your server > Clean Tomcat Work Directory...

Upvotes: 1

Related Questions