1. It must has a public constructor:
public class_name() // public can't be removed.
{
}
2. getXXX(), setXXX()
3. The class must be a public class.
4. Package the class
5. You can get the JavaBean's Property in JSP by :
<%= javabean_id.method() %>
or
<jsp:getProperty name="javabean_ID" property="property_name" />
本文详细阐述了JavaBean的四个关键设计原则:必须具有公共构造函数、getter和setter方法、类必须为公共类,并且进行打包。同时介绍了如何在JSP中获取JavaBean的属性。
458

被折叠的 条评论
为什么被折叠?



