Example 22 - JSP Bean Code
    public class UserProxy
    {
        public String formatAmount( int cents )
        {
            String res = "$";
            int dDollars = cents/100;
            int dCents = cents - ( dDollars*100 );
            res += Integer.toString( dDollars );
            res += ".";
            if ( dCents <= 9 ) res += "0";
            res += Integer.toString( dCents );
            return res;
        }
    
        public User getUser()
        {
            return fUser;
        }
      
        public ItemHome getItemHome() throws javax.naming.NamingException
        {
            if (fItemHome != null) return fItemHome;
            Context initialContext = new InitialContext();
            Object t1 = initialContext.lookup("ItemHome");
            fItemHome = (ItemHome) PortableRemoteObject.narrow(t1, ItemHome.class);
            return fItemHome;
        }
    }
            

Next Slide >>