1 Reply Latest reply on Feb 7, 2010 10:23 AM by 807574

    How does it work?

      EDIT: Think I posted in the wrong thread. Sorry for that.

      Hi. I am totally new to JEE. And I am reading the tutorial at [http://java.sun.com/javaee/6/docs/tutorial/doc/bnaby.html] trying to get a grip of it. I just did the NeatBeans tutorial and now I am a little+ confused.

      Using NeatBean6.8 and Glassfish v3. text/code below is cut&copy.

      1.<?xml version='1.0' encoding='UTF-8' ?>
      2.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      3.<html xmlns="http://www.w3.org/1999/xhtml"
      4.      xmlns:h="http://java.sun.com/jsf/html"> 
      5.   <h:head>
      6.       <title>Facelet Title</title>
      7.    </h:head>
      9.    <h:body>
      10.        Hello from Facelets
      11.   <h:outputLabel value="Thanks! There are "/>
      12.   <h:outputText value="#{MessageView.numberOfMessages}"/> 
      13.    <h:outputLabel value=" messages!"/>
      At line number 12: {MessageView.numberOfMessages} I have a class that is named MessageView. But I do not have a static method called "numberOfMessages"

      public class MessageView {
          private MessageFacade messageFacade;
          /** Creates a new instance of MessageView */
          public MessageView() {
              this.message = new Message();
           // Creates a new field
          private Message message;
          // Calls getMessage to retrieve the message
          public Message getMessage() {
             return message;
          // Returns the total number of messages
          public int getNumberOfMessages(){
             return messageFacade.findAll().size();
          // Saves the message and then returns the string "theend"
          public String postMessage(){
             return "theend";
      The program works and when I send a message the number of messages increase. But I dont have a clue how it works. Can someone be kind and explain the basic for me.
      Best regards / Ocean

      Edited by: ocean76 on Feb 7, 2010 2:04 AM
        • 1. Re: How does it work?
          ocean76 wrote:
          At line number 12: {MessageView.numberOfMessages} I have a class that is named MessageView. But I do not have a static method called "numberOfMessages"
          Think I got it.

          Quote from tutorial
          "Java Message Service API
          The Java Message Service (JMS) API is a messaging standard that allows Java EE application components to create, send, receive, and read messages. It enables distributed communication that is loosely coupled, reliable, and asynchronous."

          And that is just what I did. Am I correct ?