Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Beans themselves</h2> <p><a href="http://en.wikipedia.org/wiki/JavaBean" rel="noreferrer">JavaBeans</a> are everywhere, they're a convention and just about every single slightly larger library out there uses those conventions to automate things. Just a few reasons why JavaBeans should be used:</p> <ul> <li>They serialize nicely.</li> <li>Can be instantiated using reflection.</li> <li>Can otherwise be controlled using reflection very easily.</li> <li>Good for encapsulating actual data from business code.</li> <li>Common conventions mean anyone can use your beans AND YOU CAN USE EVERYONE ELSE'S BEANS without any kind of documentation/manual easily and in consistent manner.</li> <li>Very close to <a href="http://en.wikipedia.org/wiki/Plain_Old_Java_Object" rel="noreferrer">POJO</a>s which actually means even more interoperability between distinct parts of the system.</li> </ul> <p>Also there's of course <a href="http://en.wikipedia.org/wiki/Enterprise_JavaBean" rel="noreferrer">Enterprise JavaBeans</a> which are a whole another matter and shouldn't be mixed with plain JavaBeans. I just wanted to mention EJB:s because the names are similar and it's easy to get those two confused.</p> <h2>Beans in web applications</h2> <p>If you consider "normal" JavaBeans in web app context, they make more sense than wearing shoes in your legs. Since the Servlet specification requires for sessions to be serializable, it means you should store your data in session as something that's serializable - why not make it a bean then! Just throw your SomeBusinessDataBean into the session and you're good to go, laughably easy, specification-compliant and convenient.</p> <p>Also transferring that data around the application is easy too since JavaBeans help you to decouple parts of your application completely. Think JavaBeans as a letter and various subsystems of the application as departments within a very large corporation: Dept.A mails a bunch of data to Dept.B, Dept.B doesn't know -<em>or even care</em>- where the data came from just as it should be and can just open the letter, read stuff from it and do its thing based on that data.</p> <h2>Beans in standalone applications</h2> <p>Actually what's above applies to standalone apps too, the only difference is that you can mess up with the UI a bit more since standalone applications have stateful UI:s while web applications have statelss UI:s which in some cases only simulate stateful UI:s. Because of this difference, it's easier to make a mess with standalone application but that's worth a whole another topic and isn't directly related to JavaBeans at all.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload