李兴华java开发实战经典-IO-002

1.将字节流用字符流的形式输出
public class StreamtoChar {

	public static void main(String[] args) throws Exception {
		File file=new File("d:"+File.separator+"mytest.txt");
		Writer outer=new OutputStreamWriter(new FileOutputStream(file));
		outer.write("hello world!!");
		outer.close();
	}
}
2.将字节流用字符流的形式读入

public class StreamtoChar {

	public static void main(String[] args) throws Exception {
		File file=new File("d:"+File.separator+"mytest.txt");
		//字节流变字符流
		Reader reader=new InputStreamReader(new FileInputStream(file));
		char mychar[]=new char[1024];
		int len=reader.read(mychar);
		System.out.println(new String(mychar,0,len));
		reader.close();
		
	}

}
3.使用转换流读写字符

输出时如果是文件,则使用Filexxx,如果是内存则使用ByteArrayxxx.

public class StreamtoChar {

	public static void main(String[] args) throws Exception {

		String string="HELLO WORLD";
		ByteArrayInputStream bis=null;
		ByteArrayOutputStream bos=null;
		//向内存中输出内容(实际就是读入)
		bis=new ByteArrayInputStream(string.getBytes());
		//准备从内存中流中读取内容(实际上是输出)
		bos=new ByteArrayOutputStream();
		
		int temp=0;
		while ((temp=bis.read())!=-1) {
			char mychar=(char)temp;//读取的数字转化为char字符
			bos.write(Character.toLowerCase(mychar));
		}
		//所有的数据就全部在ByteArrayOutputStream中
		String newStr=bos.toString();//取出内容
		System.out.println(newStr);
		bis.close();
		bos.close();

	}

}
4.管道流连接两个线程

使用connect()方法连接两个管道流

class Send implements Runnable{
	private PipedOutputStream pos=null;//管道输出流
	public Send() {
		this.pos=new PipedOutputStream();
	}
	@Override
	public void run() {
		String string="Hello World";
		try {
			this.pos.write(string.getBytes());
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			pos.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
	
	//得到此线程的管道输出流
	public PipedOutputStream getPos() {
		return this.pos;
	}
	
}

class Receive implements Runnable{
	private PipedInputStream pis=null;//管道输入流
	public Receive() {
		this.pis=new PipedInputStream();
	}

	@Override
	public void run() {
		byte mybyte[]=new byte[1024];
		int len=0;
		try {
			len=this.pis.read(mybyte);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		System.out.println(new String(mybyte,0,len));
		try {
			pis.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
	
	public PipedInputStream getPis() {
		return this.pis;
	}
	
}

public class StreamtoChar {

	public static void main(String[] args)  {

		Send send=new Send();
		Receive receive=new Receive();
		//连接管道
		try {
			send.getPos().connect(receive.getPis());
		} catch (IOException e) {
			e.printStackTrace();
		}
		new Thread (send).start();
		new Thread(receive).start();	
	}

}
5.打印流
public class StreamtoChar {
	public static void main(String[] args)  {
		PrintStream ps=null;
		try {
			//需要接受一个File对象作为参数
			ps=new PrintStream(new File("d:"+File.separator+"mytest.txt"));
			ps.print("hello");
			ps.println("World");
			ps.println("1+2="+1+2);
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	
	}
}
5.打印流(使用包装流)

这是一种装饰设计,实际上还是outPutStream

public class StreamtoChar {

	public static void main(String[] args)  {

		PrintStream ps=null;
		try {
			//需要接受一个File对象作为参数
			ps=new PrintStream(new FileOutputStream(new File("d:"+File.separator+"mytest.txt")));
			ps.print("hello");
			ps.println("World!!");
			ps.println("1+2="+1+2);
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
6.打印流(格式化输出,c语言风格)
public class StreamtoChar {

	public static void main(String[] args)  {

		PrintStream ps=null;
		try {
			//需要接受一个File对象作为参数
			ps=new PrintStream(new FileOutputStream(new File("d:"+File.separator+"mytest.txt")));
			ps.print("hello");
			String name="ncepu";
			int age=23;
			float score=990.34f;
			char sex='M';
			//c语言风格的输出
			ps.printf("姓名:%s 年龄:%d 成绩:%f 性别: %c",name,age,score,sex);
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		ps.close();
	
	}
}
7.缓冲流接受键盘输入
public class StreamtoChar {

	public static void main(String[] args)  {
		BufferedReader bufferedReader=null;
		
		bufferedReader=new BufferedReader(new InputStreamReader(System.in));
		String string=null;
		System.out.println("请输入内容");
		try {
			string=bufferedReader.readLine();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		System.out.println("输入的内容为"+string);

	}

}
7.IO实例-加法操作
class InputData{
	private BufferedReader br=null;
	public InputData() {
		this.br=new BufferedReader(new InputStreamReader(System.in));
	}
	public String getString(String info) {
		String tempString=null;
		System.out.println(info);
		try {
			tempString=br.readLine();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return tempString;
		
	}
	
	public int getInt(String info,String err) {
		int temp=0;
		boolean flag=true;
		while (flag) {
			String string=this.getString(info);
			if (string.matches("^\\d+$")) {//使用正则表达式判断文本是否有数字组成
					temp=Integer.parseInt(string);
					flag=false;
			}else {
				System.out.println(err);
			}
		}
		
		return temp;
		
	}
}

public class StreamtoChar {

	public static void main(String[] args)  {
		int i=0;
		int j=0;
		InputData inputData=new InputData(); 
		i=inputData.getInt("请输入第一个数字", "输入的必须是数字,请重新输入");
		j=inputData.getInt("请输入第二个数字", "输入的必须是数字,请重新输入");		
		System.out.println(i+j);

	}

}
7.数据流(格式化输出)
public class StreamtoChar {

	public static void main(String[] args) throws Exception  {
		//声明数据输出流对象
		DataOutputStream dataOutputStream=null;
		File file=new File("D:"+File.separator+"mytest.txt");
		dataOutputStream =new DataOutputStream(new FileOutputStream(file));
		//准备数据格式
		String names[]= {"衬衣","手套","围巾"};
		float prices[]= {98.3f,30.3f,50.5f};
		int nums[]= {3,2,1};
		for (int i = 0; i < nums.length; i++) {
			dataOutputStream.writeChars(names[i]);//写入字符串
			dataOutputStream.writeChar('\t');
			dataOutputStream.writeFloat(prices[i]);
			dataOutputStream.writeChar('\t');
			dataOutputStream.writeInt(nums[i]);
			dataOutputStream.writeChar('\n');
		}
		dataOutputStream.close();
	}

}
8.数据流(格式化读取)
public class StreamtoChar {

	public static void main(String[] args) throws Exception  {
		//声明数据输入流对象
		DataInputStream dataInputStream=null;
		File file=new File("D:"+File.separator+"mytest.txt");
		dataInputStream =new DataInputStream(new FileInputStream(file));
		//准备数据格式
		String names=null;
		float prices=0.0f;
		int nums=0;
		
		char temp[]=null;//接受商品名称
		int len=0;//保存读取数据的个数
		char mychar=0;
		try {
			while (true) {
				temp=new char[200];//开闭空间
				while ((mychar=dataInputStream.readChar())!='\t') {
					temp[len]=mychar;
					len++;
				}
				names=new String(temp,0,len);//讲字符数组变成字符
				prices=dataInputStream.readFloat();//读取价格
				dataInputStream.readChar();//读取\t
				nums=dataInputStream.readInt();//读取int
				dataInputStream.readChar();//读取\n
				System.out.printf("名称:%s 价格:%5.2f 数量:%d\n",names,prices,nums);
				
			}
		} catch (Exception e) {
			// TODO: handle exception
		}
		dataInputStream.close();

	}

}
9.合并流(合并两个流)
public class StreamtoChar {

	public static void main(String[] args) throws Exception  {
		InputStream inputStream1=null;
		InputStream inputStream2=null;
		OutputStream outputStream=null;
		
		SequenceInputStream sequenceInputStream=null;

		inputStream1=new FileInputStream("D:"+File.separator+"a.txt");
		inputStream2=new FileInputStream("D:"+File.separator+"b.txt");
		outputStream=new FileOutputStream("D:"+File.separator+"ab.txt");
		
		sequenceInputStream=new SequenceInputStream(inputStream1,inputStream2);
		int temp=0;
		while ((temp=sequenceInputStream.read())!=-1) {
			outputStream.write(temp);			
		}
		sequenceInputStream.close();
		inputStream1.close();
		inputStream2.close();
		outputStream.close();
	}

}
10.压缩流(压缩包制作)
需要导java.util.zip包,使用ZipOutPutStream流
public class StreamtoChar {

	public static void main(String[] args) throws Exception  {
		//定义原始文件对象
		File file=new File("D:"+File.separator+"mytest.txt");
		//声明压缩文件对象
		File filezip=new File("D:"+File.separator+"mytest.zip");
		
		InputStream inputStream=new FileInputStream(file);
		ZipOutputStream zipOutputStream=null;
		zipOutputStream=new ZipOutputStream(new FileOutputStream(filezip));
		//设置zipEntry名字
		zipOutputStream.putNextEntry(new ZipEntry(file.getName()));
		zipOutputStream.setComment("fengraytech");//设置注释
		int temp=0;
		while((temp=inputStream.read())!=-1) {
			zipOutputStream.write(temp);
		}
		inputStream.close();
		zipOutputStream.close();
		
	}

}
11.压缩流(文件夹压缩包制作)

ZipFile类

public class StreamtoChar {

	public static void main(String[] args) throws Exception  {
		//定义原始文件对象
		File file=new File("D:"+File.separator+"mytest");
		//声明压缩文件对象
		File filezip=new File("D:"+File.separator+"mytestdir.zip");
		
		InputStream inputStream=null;
		ZipOutputStream zipOutputStream=null;
		zipOutputStream=new ZipOutputStream(new FileOutputStream(filezip));
		//多少个文件设置多少个zipEntry对象
		if(file.isDirectory()) {
			File list[] =file.listFiles();//列出全部文件
			for (int i = 0; i < list.length; i++) {
				inputStream=new FileInputStream(list[i]);
				zipOutputStream.putNextEntry(new ZipEntry(file.getName()+
						File.separator+list[i].getName()));
				int temp=0;
				while((temp=inputStream.read())!=-1) {
					zipOutputStream.write(temp);
				}
				inputStream.close();
			}
		}		
		zipOutputStream.close();		
	}
}
11.压缩流(解压缩文件)
public class StreamtoChar {

	public static void main(String[] args) throws Exception  {
		//定义原始文件对象
		File file=new File("D:"+File.separator+"mytest.zip");//找到压缩文件
		File outputFile=new File("d:"+File.separator+"mytest_unzip.txt");//设置解压缩文件和路径
		ZipFile zipFile=new ZipFile(file);//实例化zipFile对象
		System.out.println("压缩文件的名称"+zipFile.getName());
		ZipEntry entery=zipFile.getEntry("mytest.txt");//得到一个压缩实体
		
		OutputStream outputStream=new FileOutputStream(outputFile);//实例化输出流
		InputStream inputStream=zipFile.getInputStream(entery);
		int temp=0;
		while ((temp=inputStream.read())!=-1) {
			outputStream.write(temp);
			
		}
		inputStream.close();
		outputStream.close();
	}

}
12.压缩流(解压缩文件夹)
public class StreamtoChar {

	public static void main(String[] args) throws Exception  {
		//定义原始文件对象
		File file=new File("D:"+File.separator+"mytestdir.zip");//找到压缩文件
		File outFile=null;
		ZipFile zipFile=new ZipFile(file);
		ZipEntry entry=null;
		//定义压缩输入流
		ZipInputStream zipInputStream=null;
		OutputStream outputStream=null;
		InputStream input=null;
		
		zipInputStream=new ZipInputStream(new FileInputStream(file));
		while((entry=zipInputStream.getNextEntry())!=null) {
			System.out.println("解压缩:"+entry.getName()+"文件");
			outFile=new File("D:"+File.separator+entry.getName());
			if (!outFile.getParentFile().exists()) {
				outFile.getParentFile().mkdir();
			}
			if (outFile.exists()) {
				outFile.createNewFile();
			}
			
			input=zipFile.getInputStream(entry);//得到每个实体的输入流
			//实例化文件输出流
			outputStream=new FileOutputStream(outFile);//指定输出文件夹
			int temp=0;
			while ((temp=zipInputStream.read())!=-1) {
				outputStream.write(temp);
				
			}
			input.close();
			outputStream.close();
		
		}
		zipInputStream.close();

	}

}
13.对象序列化(自动序列化)
class Person implements Serializable {
	private static final long serialVersionUID=1L;
	private String name;
	private int age;
	
	public Person(String name,int age) {
		this.name=name;
		this.age=age;
	}
	
	public String toString() {
		return "姓名:"+this.name+" 年龄:"+this.age;
	}
	
}

public class SerialDemo{
	public static void main(String[] args) throws FileNotFoundException, IOException {
		File file=new File("D:"+File.separator+"mytest.txt");
		
		//声明对象输出流
		ObjectOutputStream objectOutputStream=null;
		OutputStream outputStream=new FileOutputStream(file);
		objectOutputStream=new ObjectOutputStream(new FileOutputStream(file));
		objectOutputStream.writeObject(new Person("张三",20));
		objectOutputStream.close();

	}

}
14.反序列化
public class SerialDemo{
	public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException {
		File file=new File("D:"+File.separator+"mytest.txt");
		
		//声明对象输出流
		ObjectInputStream objectInputStream=null;
		InputStream inputStream=new FileInputStream(file);
		objectInputStream=new ObjectInputStream(inputStream);
		Object object=objectInputStream.readObject();
		objectInputStream.close();
		System.out.println(object);		
	}
}
15.手动序列化(Extenalizable接口)
class Person implements Externalizable {
	private static final long serialVersionUID=1L;
	private String name;
	private int age;
	//需要定义一个无参构造方法,否则反序列化的时候会报错
	public Person() {}
	
	public Person(String name,int age) {
		this.name=name;
		this.age=age;
	}
	
	public String toString() {
		return "姓名:"+this.name+" 年龄:"+this.age;
	}

	@Override
	public void writeExternal(ObjectOutput out) throws IOException {
		out.writeObject(this.name);;
		out.writeInt(this.age);
		
	}

	@Override
	public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
		this.name=(String) in.readObject();
		this.age=in.readInt();
		
	}
	
}

public class SerialDemo{
	public static void main(String[] args) throws Exception {
		deser();
		
		
	}
	
	public static void ser() throws Exception{
		File file=new File("D:"+File.separator+"mytest.txt");		
		//声明对象输出流
		ObjectOutputStream objectOutputStream=null;
		OutputStream outputStream=new FileOutputStream(file);
		objectOutputStream=new ObjectOutputStream(new FileOutputStream(file));
		objectOutputStream.writeObject(new Person("张三",20));
		objectOutputStream.close();
	}
	
	public static void deser() throws Exception{
		File file=new File("D:"+File.separator+"mytest.txt");	
		//声明对象输入流
		ObjectInputStream objectInputStream=null;
		InputStream inputStream=new FileInputStream(file);
		objectInputStream=new ObjectInputStream(inputStream);
		Object object=objectInputStream.readObject();
		objectInputStream.close();
		System.out.println(object);
		
	}

}
16.序列化一组对象(数组对象化)
class Person implements Externalizable {
	private static final long serialVersionUID=1L;
	private String name;
	private int age;
	//需要定义一个无参构造方法,否则反序列化的时候会报错
	public Person() {}
	
	public Person(String name,int age) {
		this.name=name;
		this.age=age;
	}
	
	public String toString() {
		return "姓名:"+this.name+" 年龄:"+this.age;
	}

	@Override
	public void writeExternal(ObjectOutput out) throws IOException {
		out.writeObject(this.name);;
		out.writeInt(this.age);
		
	}

	@Override
	public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
		this.name=(String) in.readObject();
		this.age=in.readInt();
		
	}
	
}

public class SerialDemo{
	public static void main(String[] args) throws Exception {
		Person persons[]= {new Person("张三",30),new Person("李四",24),new Person("王五",34)};
		ser(persons);
		Object object[]=(Object[])deser();
		for (Object testObj : object) {
			System.out.println(testObj);
		}
		
		
	}
	
	public static void ser(Object obj) throws Exception{
		File file=new File("D:"+File.separator+"mytest.txt");		
		//声明对象输出流
		ObjectOutputStream objectOutputStream=null;
		OutputStream outputStream=new FileOutputStream(file);
		objectOutputStream=new ObjectOutputStream(new FileOutputStream(file));
		objectOutputStream.writeObject(obj);
		objectOutputStream.close();
	}
	
	public static Object[] deser() throws Exception{
		File file=new File("D:"+File.separator+"mytest.txt");	
		//声明对象输入流
		ObjectInputStream objectInputStream=null;
		InputStream inputStream=new FileInputStream(file);
		objectInputStream=new ObjectInputStream(inputStream);
		Object object[]=(Object[])objectInputStream.readObject();
		objectInputStream.close();
		//System.out.println(object);
		return object;	
	}
}
16.IO总结收尾:一个利用io做的简单的投票程序
class Student implements Comparable<Student>{
	private int stuNo;
	private String name;
	private int vote;
	public Student(int stuNo, String name, int vote) {
		this.stuNo = stuNo;
		this.name = name;
		this.vote = vote;
	}
	public int getStuNo() {
		return stuNo;
	}
	public void setStuNo(int stuNo) {
		this.stuNo = stuNo;
	}
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	public int getVote() {
		return vote;
	}
	public void setVote(int vote) {
		this.vote = vote;
	}
	@Override
	public int compareTo(Student o) {
		if (this.vote<o.vote) {
			return 1;
		}else if (this.vote>o.vote) {
			return -1;
		}
		return 0;
	}
	
}

class Operate{
	private Student student[]= {new Student(1, "张三", 0),new Student(2, "李四", 0),new Student(3,"王五", 0),new Student(4, "赵六", 0)};
	private boolean flag=true;
	public Operate() {
		this.printInfo();//先输出候选人信息
		while (flag) {
			this.vote();
		}
		this.printInfo();//输出候选人投票后的信息
		this.getResult();
	}
	
	private void getResult() {
		Arrays.sort(this.student);
		System.out.println("投票最终结果:"+this.student[0].getName()+"同学最终以:"+this.student[0].getVote()+"票当选");
	}
	public void printInfo() {
		for (int i = 0; i < student.length; i++) {
			System.out.println(this.student[i].getStuNo()+":"
					+this.student[i].getName()
					+this.student[i].getVote());
		}
	}
	public void vote() {
		InputData input=new InputData();
		int num=input.getInt("请输入班长候选人代号(数字):", "此选票无效,请输入正确的候选人代号");
		switch (num) {
		case 0:
			this.flag=false;
			break;
		case 1:
			this.student[0].setVote(this.student[0].getVote()+1);
			break;
		case 2:
			this.student[1].setVote(this.student[1].getVote()+1);
			break;
		case 3:
			this.student[2].setVote(this.student[2].getVote()+1);
			break;
		case 4:
			this.student[3].setVote(this.student[3].getVote()+1);
			break;
		default:
			System.out.println("此选票无效,请输入争取的候选人代号");
			break;
		}
	}
}

class InputData{
	private BufferedReader bufferedReader=null;
	public InputData() {
		this.bufferedReader=new BufferedReader(new InputStreamReader(System.in));
	}
	public String getString(String info) {
		String temp=null;
		System.out.println(info);
		try {
			temp=this.bufferedReader.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return temp;
		
	}
	public int getInt(String info,String string) {
		int temp=0;
		String str=null;
		boolean flag=true;
		while (flag) {
			str=this.getString(info);
			if (str.matches("\\d+")) {
				temp=Integer.parseInt(str);
				flag=false;
			}else {
				System.out.println(string);
			}
			
		}
		return temp;
		
	}
}

public class Vote {

	public static void main(String[] args) {
		new Operate();
	}

}
第1章 JAVA WEB开发简介 1.1、WEB发展历程 1.2、企业开发架构 1.3、JAVA EE架构 1.4、JAVA EE核心设计模式 1.5、Struts开发框架 1.6、本章摘要 1.7、开发实战讲解 第2章 HTML、JavaScript简介 2.1、服务器与浏览器 2.2、HTML简介 2.2.1、HTML元素概览 2.2.2、创建显示WEB页 2.2.3、创建表单WEB页 2.3、JavaScript简介 2.3.1、JavaScript的基本语法 2.3.2、事件处理 2.3.3、window对象 2.4、本章摘要 2.5、开发实战讲解 第3章 XML简介 3.1、认识XML 3.2、XML解析 3.2.1、DOM解析操作 3.2.2、SAX解析操作 3.2.3、XML解析的好帮手:JDOM 3.2.4、最出色的解析工具:DOM4J 3.3、使用JavaScript操作DOM 3.4、开发实战讲解(基于Oracle数据库) 第4章 Tomcat服务器的安装及配置 4.1、Web容器简介 4.2、Tomcat简介 4.3、Tomcat服务器的下载及配置 4.3.1、Tomcat下载 4.3.2、Tomcat安装 4.3.3、服务器配置 4.4、编写第一个jsp文件 4.5、交互性 4.6、本章摘要 4.7、开发实战讲解 第5章 JSP基础语法 5.1、JSP注释 5.2、Scriptlet 5.2.1、第一种Scriptlet: 5.2.2、第二种Scriptlet: 5.2.3、第三种Scriptlet: 5.3、Scriptlet标签 5.4、page指令 5.4.1、设置页面的MIME 5.4.2、设置文件编码 5.4.3、错误页的设置 5.4.4、数据库连接操作 5.5、包含指令 5.5.1、静态包含 5.5.2、动态包含 5.6、跳转指令 5.7、实例操作:用户登陆程序实现(JSP + JDBC实现) 5.7.1、创建数据库表 5.7.2、程序实现思路 5.7.3、程序实现 5.8、本章摘要 5.9、开发实战讲解(基于Oracle数据库) 第6章 JSP内置对象 6.1、JSP内置对象概览 6.2、四种属性范围 6.2.1、page属性范围(pageContext范围) 6.2.2、request属性范围 6.2.3、session属性范围 6.2.4、application属性范围 6.2.5、深入研究page属性范围 6.3、request对象 6.3.1、乱码解决 6.3.2、接收请求参数 6.3.3、显示全部的头信息 6.3.4、角色验证 6.3.5、其他操作 6.4、response对象 6.4.1、设置头信息 6.4.2、页面跳转 6.4.3、操作Cookie 6.5、session对象 6.5.1、取得Session Id 6.5.2、登陆及注销 6.5.3、判断新用户 6.5.4、取得用户的操作时间 6.6、application对象 6.6.1、取得虚拟目录对应的绝对路径 6.6.2、范例讲解:网站计数器 6.6.3、查看application范围的属性 6.7、WEB安全性及config对象 6.7.1、WEB安全性 6.7.2、config对象 6.8、out对象 6.9、pageContext对象 6.10、本章摘要 6.11、开发实战讲解(基于Oracle数据库) 第7章 JavaBean 7.1、JavaBean简介 7.2、在JSP中使用JavaBean 7.2.1、WEB开发的标准目录结构 7.2.2、使用JSP的page指令导入所需要的JavaBean 7.2.3、使用指令 7.3、JavaBean与表单 7.4、设置属性: 7.4.1、设置指定的属性 7.4.2、指定设置属性的参数 7.4.3、为属性设置具体内容 7.5、取得属性: 7.6、JavaBean的保存范围 7.6.1、page范围的JavaBean 7.6.2、request范围的JavaBean 7.6.3、session范围的JavaBean 7.6.4、application范围的JavaBean 7.7、JavaBean的删除 7.8、实例操作:注册验证 7.9、DAO设计模式 7.9.1、DAO设计模式简介 7.9.2、DAO开发 7.9.
第1章 JAVA WEB开发简介 1.1、WEB发展历程 1.2、企业开发架构 1.3、JAVA EE架构 1.4、JAVA EE核心设计模式 1.5、Struts开发框架 1.6、本章摘要 1.7、开发实战讲解 第2章 HTML、JavaScript简介 2.1、服务器与浏览器 2.2、HTML简介 2.2.1、HTML元素概览 2.2.2、创建显示WEB页 2.2.3、创建表单WEB页 2.3、JavaScript简介 2.3.1、JavaScript的基本语法 2.3.2、事件处理 2.3.3、window对象 2.4、本章摘要 2.5、开发实战讲解 第3章 XML简介 3.1、认识XML 3.2、XML解析 3.2.1、DOM解析操作 3.2.2、SAX解析操作 3.2.3、XML解析的好帮手:JDOM 3.2.4、最出色的解析工具:DOM4J 3.3、使用JavaScript操作DOM 3.4、开发实战讲解(基于Oracle数据库) 第4章 Tomcat服务器的安装及配置 4.1、Web容器简介 4.2、Tomcat简介 4.3、Tomcat服务器的下载及配置 4.3.1、Tomcat下载 4.3.2、Tomcat安装 4.3.3、服务器配置 4.4、编写第一个jsp文件 4.5、交互性 4.6、本章摘要 4.7、开发实战讲解 第5章 JSP基础语法 5.1、JSP注释 5.2、Scriptlet 5.2.1、第一种Scriptlet: 5.2.2、第二种Scriptlet: 5.2.3、第三种Scriptlet: 5.3、Scriptlet标签 5.4、page指令 5.4.1、设置页面的MIME 5.4.2、设置文件编码 5.4.3、错误页的设置 5.4.4、数据库连接操作 5.5、包含指令 5.5.1、静态包含 5.5.2、动态包含 5.6、跳转指令 5.7、实例操作:用户登陆程序实现(JSP + JDBC实现) 5.7.1、创建数据库表 5.7.2、程序实现思路 5.7.3、程序实现 5.8、本章摘要 5.9、开发实战讲解(基于Oracle数据库) 第6章 JSP内置对象 6.1、JSP内置对象概览 6.2、四种属性范围 6.2.1、page属性范围(pageContext范围) 6.2.2、request属性范围 6.2.3、session属性范围 6.2.4、application属性范围 6.2.5、深入研究page属性范围 6.3、request对象 6.3.1、乱码解决 6.3.2、接收请求参数 6.3.3、显示全部的头信息 6.3.4、角色验证 6.3.5、其他操作 6.4、response对象 6.4.1、设置头信息 6.4.2、页面跳转 6.4.3、操作Cookie 6.5、session对象 6.5.1、取得Session Id 6.5.2、登陆及注销 6.5.3、判断新用户 6.5.4、取得用户的操作时间 6.6、application对象 6.6.1、取得虚拟目录对应的绝对路径 6.6.2、范例讲解:网站计数器 6.6.3、查看application范围的属性 6.7、WEB安全性及config对象 6.7.1、WEB安全性 6.7.2、config对象 6.8、out对象 6.9、pageContext对象 6.10、本章摘要 6.11、开发实战讲解(基于Oracle数据库) 第7章 JavaBean 7.1、JavaBean简介 7.2、在JSP中使用JavaBean 7.2.1、WEB开发的标准目录结构 7.2.2、使用JSP的page指令导入所需要的JavaBean 7.2.3、使用指令 7.3、JavaBean与表单 7.4、设置属性: 7.4.1、设置指定的属性 7.4.2、指定设置属性的参数 7.4.3、为属性设置具体内容 7.5、取得属性: 7.6、JavaBean的保存范围 7.6.1、page范围的JavaBean 7.6.2、request范围的JavaBean 7.6.3、session范围的JavaBean 7.6.4、application范围的JavaBean 7.7、JavaBean的删除 7.8、实例操作:注册验证 7.9、DAO设计模式 7.9.1、DAO设计模式简介 7.9.2、DAO开发 7.9.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值