I started working on JSP recently.
Is it possible to call a Session Bean from JSP?
At least if anybody could send me some links,to read about it,I will appericiate that.
I had been to may sites,but couldn't find much.
one site says you can do that with the help of tag libraries.
You can call EJB by JNDI look up. Read more about JNDI
I know JNDI lookup.
But i wasn't sure whether i can do the JNDI lookup directly from JSP.
U can call it from JSP and u can also write a Java Bean which acts as a cleint to EJB. And u can write the JNDI lookup in the Java Bean.
From JSP page using <useBean> tag u can call the bean.
Asad is correct. You can write a JavaBean to act as a client to an EJB. I would actually suggest that this is a better way to do it.
It is best to keep as much Java out of JSP pages to make then more readible, and JNDI lookups is definately getting into serious Java coding.
According to the new JavaServerPages book from O´Reilly, most of the MVC model 2 architecture examples I´ve seen, and some pretty good articles on the subject, a thing like a EJB lookup should be put into a sub-class called from a servlet, and not into a Serverside Javabean.
The place of the bean as I see it, is to act as a data carrier and hence it should be us as such, with the get/set methods and members but no or very little programmatic logic beside.
I´ve used this approach in our web-apps, and provided for a cleaner separation of data and logic.
If you´re using a Controller Servlet of some sort, an ejb-action class should provide a good place for the lookup.