This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I have a bean class lets say called UserBean. I also have a class (Utils) that contains a method returning a UserBean let say Utils.getUser. Is it possible to use this method inside a UserBean object to populate itself. I.e to do what line 11 is trying to do below.
Instead of having to write
What I want to do is use UserBean in a jsp but I need to populate that bean with information that I get from the Utils class (in this example data from LDAP).
Thanks for your reply but the problem is, I want it to populate itself, not just create a new object. Reason being, I want the UserBean object to be a session bean in my jsp. So as I see it, I have to declare the <jsp:usebean> and then populate the data in the bean. How can I use the method I have created in my Utils class (which returns a UserBean) to populate this session bean?