Hi all


I wrote an applet and i want to load it in servlet.But it is not happening can anybody help me.I pasted the source code below.

Applet Code

package com.applets;

import java.applet.Applet;
import java.awt.Color;
import java.awt.Label;

public class CheckJavaVersion extends Applet {

private static final long serialVersionUID = 1L;
private Label javaVersion;
public static String versionCheck;

public CheckJavaVersion() {
Color colFrameBackground = new Color(198, 0, 0);
this.setBackground(colFrameBackground);
javaVersion = new Label(" Java Version: "+ System.getProperty("java.runtime.version"));
this.add(javaVersion);
final String versionCheck = javaVersion.getText();
System.out.println(versionCheck);
}
}


Servlet Code:

package com.servlets;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.applets.CheckJavaVersion;

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

protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {

response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<applet code=com.applets.CheckJavaVersion>");
out.println("</applet>");
String javaVersion = CheckJavaVersion.versionCheck;
out.println(javaVersion);
}

protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {

}
}

Reply fast..