当前位置: 技术问答>java相关
很奇怪的问题?各位进来看一下.
来源: 互联网 发布时间:2017-03-22
本文导语: 原程序很简单:(UsingHtmlParam.java) import java.io.*; import java.net.*; import java.util.*; import java.text.*; import javax.servlet.*; import javax.servlet.http.*; /** * * @author root * @version */ public class UsingHtmlParam extends HttpServlet { ...
原程序很简单:(UsingHtmlParam.java)
import java.io.*;
import java.net.*;
import java.util.*;
import java.text.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
*
* @author root
* @version
*/
public class UsingHtmlParam extends HttpServlet {
/** Initializes the servlet.
*/
public void init(ServletConfig config) throws ServletException {
super.init(config);
}
/** Destroys the servlet.
*/
public void destroy() {
}
/** Processes requests for both HTTP GET and POST methods.
* @param request servlet request
* @param response servlet response
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=gb2312");
PrintWriter out = response.getWriter();
//output your page here
out.println("");
out.println("");
out.println("Servlet");
out.println("");
out.println("");
out.println("Servlet通过参数PARAM传递给Applet.");
out.println("");
out.println("");
out.close();
}
/** Handles the HTTP GET method.
* @param request servlet request
* @param response servlet response
*/
public synchronized void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/** Handles the HTTP POST method.
* @param request servlet request
* @param response servlet response
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// processRequest(request, response);
}
/** Returns a short description of the servlet.
*/
public String getServletInfo() {
return "Short description";
}
}
下面是HelloWorld.java的源代码:
import java.awt.*;
public class HelloWorld extends java.applet.Applet {
/** Initialization method that will be called after the applet is loaded
* into the browser.
*/
public void init() {
resize(356, 356);
}
public void paint(Graphics g){
String date=getParameter("Date");
g.drawString("Hello world! You accessed me at "+date+"!",50,25);
}
}
屏幕上能够显示"Servlet通过参数PARAM传递给Applet."
最后的出错提示为;"HelloWorld.class could not be loaded".
请问各位同仁,问题出在什么地方?
import java.io.*;
import java.net.*;
import java.util.*;
import java.text.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
*
* @author root
* @version
*/
public class UsingHtmlParam extends HttpServlet {
/** Initializes the servlet.
*/
public void init(ServletConfig config) throws ServletException {
super.init(config);
}
/** Destroys the servlet.
*/
public void destroy() {
}
/** Processes requests for both HTTP GET and POST methods.
* @param request servlet request
* @param response servlet response
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=gb2312");
PrintWriter out = response.getWriter();
//output your page here
out.println("");
out.println("");
out.println("Servlet");
out.println("");
out.println("");
out.println("Servlet通过参数PARAM传递给Applet.");
out.println("");
out.println("");
out.close();
}
/** Handles the HTTP GET method.
* @param request servlet request
* @param response servlet response
*/
public synchronized void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/** Handles the HTTP POST method.
* @param request servlet request
* @param response servlet response
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// processRequest(request, response);
}
/** Returns a short description of the servlet.
*/
public String getServletInfo() {
return "Short description";
}
}
下面是HelloWorld.java的源代码:
import java.awt.*;
public class HelloWorld extends java.applet.Applet {
/** Initialization method that will be called after the applet is loaded
* into the browser.
*/
public void init() {
resize(356, 356);
}
public void paint(Graphics g){
String date=getParameter("Date");
g.drawString("Hello world! You accessed me at "+date+"!",50,25);
}
}
屏幕上能够显示"Servlet通过参数PARAM传递给Applet."
最后的出错提示为;"HelloWorld.class could not be loaded".
请问各位同仁,问题出在什么地方?
|
try again?
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。