[Java123] JavaBean
https://stackoverflow.com/questions/3295496/what-is-a-javabean-exactly
A JavaBean is just a standard
- All properties private (use getters/setters)
- A public no-argument constructor
- Implements
Serializable.
That's it. It's just a convention. Lots of libraries depend on it though.
With respect to Serializable, from the API documentation:
Serializability of a class is enabled by the class implementing the java.io.Serializable interface. Classes that do not implement this interface will not have any of their state serialized or deserialized. All subtypes of a serializable class are themselves serializable. The serialization interface has no methods or fields and serves only to identify the semantics of being serializable.
In other words, serializable objects can be written to streams, and hence files, object databases, anything really.
Also, there is no syntactic difference between a JavaBean and another class -- a class is a JavaBean if it follows the standards.
There is a term for it because the standard allows libraries to programmatically do things with class instances you define in a predefined way. For example, if a library wants to stream any object you pass into it, it knows it can because your object is serializable (assuming the lib requires your objects be proper JavaBeans).
https://stackoverflow.com/questions/1973073/what-is-a-java-bean
[Java123] JavaBean的更多相关文章
- java web学习总结(二十九) -------------------JavaBean的两种开发模式
SUN公司推出JSP技术后,同时也推荐了两种web应用程序的开发模式,一种是JSP+JavaBean模式,一种是Servlet+JSP+JavaBean模式. 一.JSP+JavaBean开发模式 1 ...
- java web学习总结(二十八) -------------------JSP中的JavaBean
一.什么是JavaBean JavaBean是一个遵循特定写法的Java类,它通常具有如下特点: 这个Java类必须具有一个无参的构造函数 属性必须私有化. 私有化的属性必须通过public类型的方法 ...
- JavaBean的用法
JavaBean是一个可重复使用的软件组件,是用Java语言编写的.遵循一定标准的类. JavaBean是Java Web的重要组件,它封装了数据和操作的功能类,供JSP和Servlet调用,完成数据 ...
- JSP复习整理(五)JavaBean使用表单处理数据
一.先建立用户输入的数据 usingGetparameter.html <!DOCTYPE html> <html> <head> <meta charset ...
- JSP复习整理(五)JavaBean生命周期
一.创建一个JavaBean UserBean.java package jsp.test; public class UserBean { private String userName; priv ...
- 初识Jsp,JavaBean,Servlet以及一个简单mvc模式的登录界面
1:JSP JSP的基本语法:指令标识page,include,taglib;page指令标识常用的属性包含Language用来定义要使用的脚本语言:contentType定义JSP字符的编码和页面响 ...
- json、javaBean、xml互转的几种工具介绍
json.javaBean.xml互转的几种工具介绍 转载至:http://blog.csdn.net/sdyy321/article/details/7024236 工作中经常要用到Json.Jav ...
- javabean和jsp动作元素
model1就是利用了jsp和javabean 的组合来处理问题.jsp页面如果有太多的逻辑代码的话,维护起来和扩展起来是相当的麻烦的.所以jsp的逻辑代码部分都打包到一种java类当中进行编写.这种 ...
- J2EE基础之JavaBean
J2EE基础之JavaBean 1.什么是JavaBean? JavaBean本质上来说就是一个Java类,它通过封装属性和方法成为具有独立功能.可重复使用的,并可以与其他控件通信的组件对象.通过在J ...
随机推荐
- Guidlines and rules About Overwriting hashCode()
Preface "The code is more what you’d call guidelines than actual rules" – truer words were ...
- 湘潭校赛 Hard Wuxing
Hard Wuxing Accepted : 13 Submit : 166 Time Limit : 1000 MS Memory Limit : 65536 KB 题目描述 “五行”是中国 ...
- Go 中包导入声明
Go中的程序由软件包组成.通常,软件包依赖于其他软件包,或者内置于标准库或第三方的软件包.包需要先导入才能使用其导出的标识符.本文将翻译一篇国外的文章,用于介绍包导入的原理以及几种常用的导入方式. & ...
- UVA11624(KB1-J)
Fire! Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of ...
- [AMPPZ2014]Petrol
关键点的最小生成树? 关键点初始化为0,跑多源最短路,然后重构整个图,用Kruskal跑最小生成树 然后跑树链剖分在线回答询问 对树上每个点维护到链顶的最大值,结合线段树可以做到\(\Theta(n ...
- 基于token的后台身份验证(转载)
几种常用的认证机制 HTTP Basic Auth HTTP Basic Auth简单点说明就是每次请求API时都提供用户的username和password,简言之,Basic Auth是配合RES ...
- Android Service不能再详细的教程
这篇包含了: Service后台服务.前台服务.IntentService.跨进程服务.无障碍服务.系统服务 几乎所有Android Service相关的东西. 前言 作为四大组件之一的Service ...
- java 内存分析之方法返回值二
package Demo; class Point { private double x, y; public Point(double x, double y) { this.x = x; this ...
- leetCode题解之反转字符串中的元音字母
1.问题描述 Reverse Vowels of a String Write a function that takes a string as input and reverse only the ...
- springCloud微服务入门
目录 前言 Eureka 注册中心server 新建 配置 服务提供者service 新建 配置 服务消费者controller 新建 配置 使用 Feign负载均衡 前言 springCloud是一 ...