JAVA EE JSP_Servlet

Servlet API  

http://java.sun.com/products/servlet/2.5/docs/servlet-2_5-mr2/index.html
http://tomcat.apache.org/tomcat-5.5-doc/servletapi/index.html  
http://jakarta.apache.org/taglibs/index.html  
http://archive.apache.org/dist/jakarta/taglibs/standard/  
http://archive.apache.org/dist/jakarta/taglibs/standard/binaries/  
http://archive.apache.org/dist/jakarta/taglibs/standard/source/  

 

 

servlet2.5/jsp2.1的新特征

http://www.blogjava.net/simie/archive/2007/07/02/127500.html

 

http://poko.5d6d.com/thread-867-1-1.html

当前位置: AJava主页 > 视频教程

http://ajava.org/video/index.html

 

【韩顺平】【j2ee视频实战教程】【全】

韩顺平j2ee 视频 实战 教程 servlet第0讲开山
ftp ://125.64.92.37/book7/2007082 ... cb-6a73d4a6697a.rar
韩顺平j2ee视频实战教程servlet第1讲初识
ftp://125.64.92.37/book7/2007082 ... 02-e846667b255e.rar
韩顺平j2ee视频实战教程servlet第2讲(上集)
ftp://125.64.92.37/book7/2007082 ... 16-e16774fba643.rar
韩顺平j2ee视频实战教程servlet第2讲(下集)
ftp://125.64.92.37/book7/2007082 ... af-5bd936a37fc8.rar
韩顺平j2ee视频实战教程servlet第3讲(上集)
http://download1.gbaopan.com/6c3 ... ?supplierID=2841214
韩顺平j2ee视频实战教程servlet第3讲(中集)
http://download2.gbaopan.com/9aa ... ?supplierID=2841214
韩顺平j2ee视频实战教程servlet第3讲(下集)
http://download2.gbaopan.com/7ac ... ?supplierID=2841214
韩顺平j2ee视频实战教程servlet第4讲 
ftp://125.64.92.37/book7/2007082 ... a5-79b02278a5d2.rar
韩顺平j2ee视频实战教程servlet第5讲(上集)
http://download2.gbaopan.com/8af ... ?supplierID=2841214
韩顺平j2ee视频实战教程servlet第5讲(下集)
http://download2.gbaopan.com/08c ... ?supplierID=2841214
韩顺平j2ee视频实战教程servlet第6讲(上集)
ftp://222.214.218.61/video5/2008 ... 75-da10a631b4fa.rar
韩顺平j2ee视频实战教程servlet第6讲(下集)
ftp://222.214.218.61/video5/2008 ... 4b-da23edaf2321.rar
韩顺平j2ee视频实战教程servlet第7讲(上集)
ftp://222.214.218.61/video5/2008 ... f9-30b7e18c16fc.rar
韩顺平j2ee视频实战教程servlet第7讲(下集)
ftp://222.214.218.61/video5/2008 ... f0-c99afd00e690.rar
韩顺平j2ee视频实战教程servlet第8讲
ftp://222.214.218.61/video5/2008 ... 64-726724762f57.rar

 

 

 

page        打开页面即产生
                关闭当前页面即失效


request
                跳转即产生
                关闭页面即失效
                一般页面请求到哪,随带的参数跟到哪

session
                默认作用域时间=30小时
                关闭浏览器即失效
                只要放一次即保存在服务器里

//cookie    session可以看作是对cookie的简单封装
                    保存在客户端

servletContext
                关闭服务器及失效
               
doGet     明文传送
doPost  密文传送

 

java web验证码生成总结(包括servlet、jsp和struts2实现)

http://blog.csdn.net/wirror800/archive/2009/02/16/3897115.aspx

一、使用纯Servlet实现验证码

二、使用纯jsp实现验证码

三、使用Struts2来实现验证码

 

四、小结

    对于java的web技术,归根究底还是在服务器端执行的servlet.从上面的三种不同实现中,我们很容易察觉到他们存在一个共同点,那就是返回浏览器端的contentType。

    servlet:使用response.setContentType(" ");方法来实现

    jsp:在<@ page contentType=" ">中来实现

    struts2:通过配置<param name="contentType"> </param>来实现

数字验证码小图生成程序, 支持背景图和文字旋转.

http://yangyi.iteye.com/blog/38749

 

 

《Struts2 权威指南》p178

 

<%@ page language="java" import="java.util.*" pageEncoding="utf-8" contentType="text/html; charset=utf-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <title>My JSP 'index.jsp' starting page</title>
        <meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">
        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="This is my page">
        <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
    </head>

    <body>
        <%--enctype="application/x-www-form-urlencoded" --%>
        <form action="POST.jsp" name="form1" method="post"
            enctype="multipart/form-data">
            上传文件:
            <input type="file" name="file" />
            <br>
            请求参数:
            <input type="text" name="parameter" />
            <br>
            提交按钮:
            <input name="submit" type="submit" value="确认提交">
        </form>
    </body>
</html>

 

asdfadsfdsaf

 

 

<%@ page language="java" pageEncoding="utf-8"
	contentType="text/html; charset=utf-8"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'POST.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

	</head>

	<body>
		<br>
		<%
			//设置HttpServletRequest使用GBK的编码方式 ,默认会是二进制传输方式 如"%E6%8F%90%E4%BA%A4",不易看懂
			//request.setCharacterEncoding("UTF-8");
			//直接在页面上输出两个请求参数值
			//out.println("parameter 请求的值为:" + request.getParameter("parameter")
			//		+ "<br>");
			//out.println("file  	  请求的参数为:" + request.getParameter("file")
			//		+ "<br>");
		%>
		
		<% 
			//获取http请求的输入流
			InputStream is = request.getInputStream();
			//以http请求输入流建立一个BufferRader对象
			BufferedReader br = new BufferedReader(new InputStreamReader(is));
			//读取http请求内容
			String buffer = null;
			while ((buffer = br.readLine()) != null) {
				out.println(buffer + "<br>");
			}
		%>
		
	</body>
</html>

 

Servlet

E:\zhouwork\lindows>tree /f

E:.
│  .project
│  .mymetadata
│  .classpath

├─src
│  └─com
│      └─javaeye
│          └─lindows
│              ├─net
│              │      TestCode.java
│              │      URL.java
│              │
│              ├─test
│              │      Test.java
│              │
│              └─servlet
│                      Hello.java

├─WebRoot
│  │  index.jsp
│  │
│  ├─WEB-INF
│  │  │  web.xml
│  │  │
│  │  ├─lib
│  │  │      servlet-api.jar
│  │  │
│  │  └─classes
│  │      └─com
│  │          └─javaeye
│  │              └─lindows
│  │                  ├─test
│  │                  │      Test.class
│  │                  │
│  │                  ├─servlet
│  │                  │      Hello.class
│  │                  │
│  │                  └─net
│  │                          URL.class
│  │                          TestCode.class
│  │
│  └─META-INF
│          MANIFEST.MF

└─.myeclipse

Hello.java

package com.javaeye.lindows.servlet;

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

import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class Hello implements Servlet {
	public ServletConfig getServletConfig() {
		return null;
	}

	public String getServletInfo() {
		return null;
	}
 
	// tomcat容器初始化创建实例只一次与内存中,不用手工new,类似于构造函数
	public void init(ServletConfig arg0) throws ServletException {
		System.out.println("init it ... ");
	}

	// 页面多次刷新请求后,tomcat容器控制台将打印该句多次
	public void service(ServletRequest req, ServletResponse resp)
			throws ServletException, IOException {
		PrintWriter pw = resp.getWriter();
		pw.println("Hello World ! i'm lindows ...");
		System.out.println("server it ... ");
	}

	// 实例销毁只一次,释放内存. //webApp重新部署后(reload)或关闭tomcat或关机即销毁实例
	public void destroy() {
		System.out.println("destroy it ... ");
	}

}

 web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
	http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
	<servlet>
		<servlet-name>hello1</servlet-name>
		<servlet-class>com.javaeye.lindows.servlet.Hello</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>hello1</servlet-name>
		<url-pattern>/hehe</url-pattern>
	</servlet-mapping>
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>
</web-app>
 

end

你可能感兴趣的:(java,tomcat,jsp,javaee,servlet)