| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1078 人关注过本帖
标题:请问Eclipse+MyEclipse下如何编译呢?
取消只看楼主 加入收藏
lyd8935
Rank: 1
等 级:新手上路
帖 子:219
专家分:0
注 册:2006-5-14
收藏
 问题点数:0 回复次数:0 
请问Eclipse+MyEclipse下如何编译呢?

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;

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

public class LoginServlet extends HttpServlet {

private static final String CONTENT_TYPE = "text/html; charset = GBK";

public LoginServlet() {
super();
}

public void init() throws ServletException {

}

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType(CONTENT_TYPE);
response.setCharacterEncoding("GB2312");
PrintWriter out = response.getWriter();
try {
String username = request.getParameter("username");
String password = request.getParameter("parssword");
if (username.equals("") || password.equals("")) {
userInterface(response);
} else {
out.println("<b>" + username + "</b> 欢迎第一次使用Servlet<br/>");
out.println("<b> 今天的日期是 : </b>" + new Date());
}
} catch (Exception e) {
userInterface(response);
}
}

public void userInterface(HttpServletResponse response) throws IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out
.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>loginservlet</TITLE></HEAD>");
out.println(" <BODY bocolor=\"#ffffff\">");
out.print(" <h1 align=center> 欢迎第一次使用servlet</h1>");
out.print("<form method = post action=/ServletModule/loginservlet");
out.println("<br>");
out.println("用户名: <input type='text' name='username'><br/>");
out.println("密码: <input type='passowrd' name='password'><br/>");
out.println("input type=submit value='提交'><br/>");
out.println("</form>");
out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
}

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

doGet(request, response);
}

public void destroy() {

}
}

//在 web project 下
请问下面这段代码在 Eclipse+MyEclipse+tomcat 下 如何编译呢?

[此贴子已经被作者于2006-9-24 21:48:06编辑过]



q5NEiLxm.bmp (1021.5 KB)
图片附件: 游客没有浏览图片的权限,请 登录注册
搜索更多相关主题的帖子: Eclipse 编译 
2006-09-24 21:40
快速回复:请问Eclipse+MyEclipse下如何编译呢?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017329 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved