topic = (Topic) initialContext.lookup("topic/topicRegisterUser");
topic = (Topic) initialContext.lookup(Config.PrefixTopicName+"topicRegisterUser");
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException  {    String firstname=null, lastname=null, nickname=null, email=null, password=null;    int    regionId = 0;    int    userId;    String creationDate, regionName;    sp = new ServletPrinter(response, "RegisterUser");          Context initialContext = null;    try    {      initialContext = new InitialContext();    }     catch (Exception e)     {      printError("Cannot get initial context for JNDI: " + e+"<br>");      return ;    }    String value = request.getParameter("firstname");    if ((value == null) || (value.equals("")))    {      printError("You must provide a first name!<br>");      return ;    }    else      firstname = value;    value = request.getParameter("lastname");    if ((value == null) || (value.equals("")))    {      printError("You must provide a last name!<br>");      return ;    }    else      lastname = value;    value = request.getParameter("nickname");    if ((value == null) || (value.equals("")))    {      printError("You must provide a nick name!<br>");      return ;    }    else      nickname = value;    value = request.getParameter("email");    if ((value == null) || (value.equals("")))    {      printError("You must provide an email address!<br>");      return ;    }    else      email = value;    value = request.getParameter("password");    if ((value == null) || (value.equals("")))    {      printError("You must provide a password!<br>");      return ;    }    else      password = value;    value = request.getParameter("region");    if ((value == null) || (value.equals("")))    {      printError("You must provide a valid region!<br>");      return ;    }    else      regionName = value;    // Try to create a new user    TopicConnectionFactory topicFactory = null;    TopicConnection connection = null;    TopicSession session  = null;    Topic topic = null;    String html;    try     {      // lookup the connection factory      topicFactory = (TopicConnectionFactory)initialContext.lookup(Config.TopicConnectionFactoryName);      // create a connection to the JMS provider      connection = topicFactory.createTopicConnection();      // lookup the destination      topic = (Topic) initialContext.lookup("topic/topicRegisterUser");      // create a session      session  = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); // no transaction and auto ack    }     catch (Exception e)    {      sp.printHTML("Cannot connect to message bean MDB_RegisterUser : " +e+"<br>");      return ;    }    try     {      // create a requestor to receive the reply      TopicRequestor requestor = new TopicRequestor(session, topic);      // create a message      MapMessage message = session.createMapMessage();      // set parameters      message.setString("firstname", firstname);      message.setString("lastname", lastname);      message.setString("nickname", nickname);      message.setString("email", email);      message.setString("password", password);      message.setString("region", regionName);      message.setJMSCorrelationID("registerUser");      // send the message and receive the reply      connection.start(); // allows message to be delivered (default is connection stopped)      TextMessage reply = (TextMessage)requestor.request(message);      connection.stop();      // read the reply      html = reply.getText();      // close connection and session      requestor.close(); // also close the session      connection.close();    }     catch (Exception e)    {      sp.printHTML("User registration failed: " +e+"<br>");      return ;    }    sp.printHTMLheader("RUBiS: Welcome to "+nickname);    sp.printHTML("<h2>Your registration has been processed successfully</h2><br>\n");    sp.printHTML("<h3>Welcome "+nickname+"</h3>\n");    sp.printHTML("RUBiS has stored the following information about you:<br>\n");    sp.printHTML("First Name : "+firstname+"<br>\n");    sp.printHTML("Last Name  : "+lastname+"<br>\n");    sp.printHTML("Nick Name  : "+nickname+"<br>\n");    sp.printHTML("Email      : "+email+"<br>\n");    sp.printHTML("Password   : "+password+"<br>\n");    sp.printHTML("Region     : "+regionName+"<br>\n");    sp.printHTML("<br>The following information has been automatically generated by RUBiS:<br>\n");    sp.printHTML(html);    sp.printHTMLfooter();  }