Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

communicating ejb with struts???  RSS feed

 
jaspal singh
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,

can u tell me how can i communicate to ejb using struts 1.2.

thanx in adavance.

jaspal.
 
ravi indra
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
u can call an ejb from struts either from the action servlet or if it is an entity bean we can call it as part of model in the MVC architecture.
but after getting some return value from the ejb in struts, if we need to disply the same result to a jsp page we need to either store the value in the request attribute or some other session etc. and in the jsp we can retrieve it using getAttribute as request and session or implicit variables.
 
jaspal singh
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanx alot.

i'll test it;if any problem arised,will contact u.
 
Sivakumar Nachimuthu
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
It is not advisable to use Entity Beans directly in the action servlet.
A session bean can be written to call the Entity Beans and return the values as a valueobject to the Action . Action Form can have a method to convert ValueObject to the form fields.

Thanks
Siva
 
Wasim Ayoubi
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Struts is located in the presentation tier while EJB is located in the business tier, you can do some thing between these two tiers like using the delegate (POJO) pattern to communicate with a facade (Session bean) which talks to either Entity beans or Session Beans or even DAO's.

Struts is an MVC pattern. Delegates (Considered as Model) should be accessed using the Controller.
[ January 04, 2006: Message edited by: Wasim Ayoubi ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!