>Just wondering if anyone had successfully made this happen -- I want to have
>a persistent user object (ejb entity bean) which will be in my JSP session
>everytime a cookie-authenticated/HTTP-authenticated user comes to my site.
>
>Has anyone been able to do this with JSP and existing ejb servers out there?
>I'd rather use this than have to make my own home grown
>object-serialisation/persistence thing.
We do the same thing over here, though I'm not really sure what you're getting at. The EJB container will handle the persistence, we just store the reference in the session (the reference will be serializable).
We use JSP "model 2" here, which means our servlet code looks something like this:
HttpSession sess = req.getSession(true);
UserObject obj = context.findByUsername(name);
sess.putValue("user", obj);
And our JSP looks something like this:
<USEBEAN NAME="user" TYPE="com.nytimes.UserObject" LIFESPAN="session">
</USEBEAN>
Thus we access it as a regular JavaBean.
If you are using the "model 1" approach (only JSPs, no servlets) you could probably just do all the session stuff inside some <% ... %> tags.
There is no "native" EJB support in JSP 0.92. You'll have to do the coding above. Sun has implied they'll have a more direct way of accessing EJBs in future versions, but at the rate they're going that should be well into the next millenium.
-Ben
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JSP-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
- jsp and ejb Bradley Wood
- Re: jsp and ejb Joe Shevland
- JSP and EJB Ben Engber
- JSP and EJB Chourishi Maneesh
