2 Replies Latest reply on Feb 17, 2002 4:15 AM by Ñòàíèñëàâ

    Return Interface(object) from EJB to JSP/JavaBean, it got nu

    Gordon Luk Newbie

      Hi all,

      I got a question, that is , i programming in three tier model, JSP/JavaBean ---> EJB ---> SQL. at the EJB side , it had a real object in it, but in JSP(Client) got null.

      i had a interface , for example :

      public interface SysUser extends java.io.Serializable {
      public String getName();
      public void setName(String Name);
      }
      then i have a abstract class, as my common implement. like this..

      public abstract class AbstractSysUser implements SysUser {
      privte String _Name = "";
      public String getName() {
      return _Name;
      }
      public void setName(String Name){
      _Name = Name;
      }
      }

      and then some classes inherit from AbstractSysUser for other purpose ... like grep data from Database...etc...
      _________________________________________________________
      Ok... at EJB side, i wrote a stateful/less bean,

      public class WantSysUserBean implements javax.ejb.SessionBean { ...... // i had a method like this...

      public SysUser getSysUser() throws java.rmi.RemoteException {
      SysUser _result = null;
      _result = SomeMethodgetConcertSysUserObject();
      System.out.println("I got SysUser , Name : " + _result.getName());
      return _result;
      }
      .....}

      __________________________________________________________
      Client... (JSP/JavaBean) Side :

      ....public JavaBeanGetSysUser() {
      SysUserInf _result = null;
      _sysuserejb = ... lookup WantSysUser EJB ...got home, create ejb....;
      _result = _sysuserejb.getSysUser();
      if ( _result == null ) {
      System.out.println("So bad, it got null");
      }
      }
      __________________________________________________

      At last, JSP (client side) got null, return "So bad, it go null", but look in ejb, it really got the object.... why it via RMI/IIOP ( <--- not sure :-) ), it return NULL!!!

      Please help.

      Gordon