特别篇_搭建eclipse服务器_141017
来源:互联网 发布:dlp数据泄露防护 编辑:程序博客网 时间:2024/04/30 02:36
事先说明,个人为64位电脑,安装了apache-TomCat , 以及Eclpse-EE。
这两个都是不需要安装的,直接解压就可以用了
本文最后会附带下载链接。
第一步: 打开eclipse EE --> File --> new --> Dynamic Web Project ;
第二步:填入参数如图:
注意: 在TargetRuntime一栏,选择 Apache Tomcat v8.0 ,会跳出一个 Tomcat Installation Directory, 请选择之前你放置 tomcat的目录
第三步: 一路next + finish 就结束了。
任意,写入jsp或xml或java文件,就是自己操作了
最后贴上一个自己写的代码:
功能: 用来接受 get 和 post 请求
package com.yline.show_54;import java.io.IOException;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;/** * Servlet implementation class show_54 */@WebServlet("/show_54")public class show_54 extends HttpServlet {private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public show_54() { super(); }/** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {String username = request.getParameter("username");String password = request.getParameter("password");System.out.println("username:"+username);System.out.println("password:"+password);if("yline江".equals(username)&&"123".equals(password)){response.getOutputStream().write("登陆成功".getBytes());}else{response.getOutputStream().write("登陆失败".getBytes());}}@Overrideprotected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {String username = new String(req.getParameter("username").getBytes("iso-8859-1"),"utf-8");String password = req.getParameter("password");System.out.println("username:"+username);System.out.println("password:"+password);if("yline江".equals(username)&&"123".equals(password)){resp.getOutputStream().write("登陆成功".getBytes());}else{resp.getOutputStream().write("登陆失败".getBytes());}}}
jsp文件:
<%@ page language="java" contentType="text/html; charset=gb2312" pageEncoding="gb2312"%><!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=gb2312"><title>Insert title here</title></head><body>多的是你不知道的事<br>多的是你不知道的事<br>多的是你不知道的事<br>多的是你不知道的事<br>多的是你不知道的事<br></body></html>
jsp文件的运行结果:
注意:在上图中的 URL地址,中的locallhost指的是自己电脑的IP,所以,在eclipse中使用的时候,要把locallhost改成自己的IP
查询电脑IP 方法:
1 输入cmd -> 进入命令行
2 输入ipconfig
apache-tomcat-8.0.14-windows-x64 下载链接:
官网: http://tomcat.apache.org/download-80.cgi
个人: http://pan.baidu.com/s/1i39UQfN
eclipse EE 下载链接:
http://pan.baidu.com/s/1mgxD2U8
本文代码下载链接:
http://pan.baidu.com/s/1kTp7XER
0 0
- 特别篇_搭建eclipse服务器_141017
- 210学习日记_特别篇
- eclipse搭建tomcat服务器
- 阿里云服务器搭建spark特别坑的地方
- eclipse下tomcat服务器环境的搭建
- 使用Eclipse搭建简易Android服务器
- CentOS搭建SVN服务器及使用Eclipse连接SVN服务器
- CentOS搭建SVN服务器及使用Eclipse连接SVN服务器
- 今天是一个特别的日子 <^_^>
- 大型文件下载_特别推荐
- Windows XP 搭建PPPoE服务器_计算机软件及应用_IT/计算机_专业资料
- [网络编程]_[初级]_[Windows网络编程之搭建服务器和客户端]
- SVN服务器及eclipse svn客户端、TortoiseSVN的搭建
- svn服务器搭建及eclipse中svn插件的使用
- SVN本地服务器搭建及在Eclipse中的应用
- 纯Java+eclipse+Asix2+Tomcat8+SQLite (搭建本地服务器)
- Web服务器及Eclipse JavaEE集成开发环境的搭建
- 《从零开始搭建游戏服务器》Eclipse和Tomcat安装配置
- Linux系统调用列表
- 联想S720/S720i通刷刷机包 Vibe V1.0
- 自我介绍-王安琪
- @Column 的使用
- nagios设置笔记-短信
- 特别篇_搭建eclipse服务器_141017
- [PHP]php中的JSON
- The 2014 ACM-ICPC Asia Mudanjiang Regional Contest - A.Average Score
- A Activity 跳到B Activity 如何跳转之后 结束A
- The 2014 ACM-ICPC Asia Mudanjiang Regional Contest - I.Information Entropy
- 百度地图开发——简单的显示地图界面(图解)
- 第三,四周周工作及计划表
- 关于GCD的简单认识
- 自动装箱与拆箱