0

I developed a Java application with three classes and a main. I would have a web interface in order to replace this main. Example : a function (in one of my classes) is called by a HTML button and its result is visible in a combo list.

Then, I used Java EE but, after reading severals tutorials, I begin to mix everything. My classes must be modified to respect the Java EE model? I understand that it must be either an EJB or a JavaBean. How to know what type they belong?

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
user3661334
  • 95
  • 2
  • 9
  • 1
    You can find the Java EE 7 tutorial here: http://docs.oracle.com/javaee/7/tutorial/doc/ – Puce Jun 27 '14 at 09:40

1 Answers1

0

A bean is a java object managed by a container. The container is the environment in which is deployed your project. There is various possible container, Spring, servlet container, Java EE one...

The same java class may be a managed bean if deployed in a JSF project or a CDI one ; or an EJB bean if deployed in an EJB project ; or a spring bean if your application is using spring IOC container, it's just a matter of configuration (using annotation or XML configuration).

To deploy your project as a web project you need a web server (tomcat, jetty...) or a Java EE one (glassfish, jboss...) or a lightweight http server (https://github.com/CodeStory/fluent-http for example).

I'd advise to use tomcat and the jsf framework to begin according to your requierement (JSF 2.0 tutorial with Eclipse and Tomcat). Otherwise you could try tomcat with rest services exposed to a javascript client (http://www.vogella.com/tutorials/REST/article.html)

For information, have a look to BalusC anwser about JavaEE : What exactly is Java EE?

Good learning

Community
  • 1
  • 1
Gab
  • 7,869
  • 4
  • 37
  • 68
  • 1
    A JavaBean doesn't have to be managed by a container. It's just some naming conventions etc. – Puce Jun 27 '14 at 10:45
  • :D a purist. You're perfectly right but the main interest is to allow the object manipulation per the environment: framework, container, editor, etc... a bean alone is just a POJO – Gab Jun 27 '14 at 12:20