You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Cameron Ingram0 <ci...@tampabay.rr.com> on 2001/02/27 12:37:48 UTC

Stupd question about Struts and EJB.

I am in the process of convincing my company to go with MVC and Struts. As with any thing new, people are sometimes resistant 
to change. One of the opposition questions I am getting is, how will this work with EJB(problem is I don't know too much about EJB currently).  Do the EJB's references just go in the Form and Action Bean and every thing else behaves the same? Are there any obvious points that I can bring up on the subject? 
Any help on this subject would be much appreciated!

Thanks, Cameron Ingram

Re: Stupd question about Struts and EJB.

Posted by Maya Muchnik <mm...@pumatech.com>.
I have the similar case with Beans not implemented "Serializable". I will use
PropertyUtils.copyProperties(destBean, srcBean) to propogate the properties.

Nick Pellow wrote:

> Hello,
>
> Robert Leland wrote:
> >
> > As far as struts 1.0, the Form bean is used only to redisplay
> > information to the jsp page. Typically the EJB might be loaded/unloaded in the
> > action class. If you search www.mail-archives.co,m Craig talked more about this in detail.
>
> My understanding is that with struts you should keep your EJBs entirely
> independant of
> anything to do with struts or servlets. You can and should however have
> a standard naming
> convention for the getters and setters across the EJB, the ActionForm
> and the html form elements.
> this allows you to call PropertyUtils.copyProperties(java.lang.Object
> dest, java.lang.Object orig)
> when you are ready to store the details entered by the user.
>
> Please let me know if this does not sound right.
>
> Cheers,
> Nick
>
> > In future version of struts this may be enhanced.
> >
> > -Rob
> >
> > > Cameron Ingram0 wrote:
> > >
> > > I am in the process of convincing my company to go with MVC and Struts. As with any thing new,
> > > people are sometimes resistant
> > > to change. One of the opposition questions I am getting is, how will this work with EJB(problem is
> > > I don't know too much about EJB currently).  Do the EJB's references just go in the Form and
> > > Action Bean and every thing else behaves the same? Are there any obvious points that I can bring
> > > up on the subject?
> > > Any help on this subject would be much appreciated!
> > >
> > > Thanks, Cameron Ingram


Re: Stupd question about Struts and EJB.

Posted by Nick Pellow <ni...@cortexebusiness.com.au>.
Hello, 

Robert Leland wrote:
> 
> As far as struts 1.0, the Form bean is used only to redisplay
> information to the jsp page. Typically the EJB might be loaded/unloaded in the
> action class. If you search www.mail-archives.co,m Craig talked more about this in detail.

My understanding is that with struts you should keep your EJBs entirely
independant of
anything to do with struts or servlets. You can and should however have
a standard naming
convention for the getters and setters across the EJB, the ActionForm
and the html form elements.
this allows you to call PropertyUtils.copyProperties(java.lang.Object
dest, java.lang.Object orig)
when you are ready to store the details entered by the user.

Please let me know if this does not sound right.

Cheers, 
Nick

> In future version of struts this may be enhanced.
> 
> -Rob
> 
> > Cameron Ingram0 wrote:
> >
> > I am in the process of convincing my company to go with MVC and Struts. As with any thing new,
> > people are sometimes resistant
> > to change. One of the opposition questions I am getting is, how will this work with EJB(problem is
> > I don't know too much about EJB currently).  Do the EJB's references just go in the Form and
> > Action Bean and every thing else behaves the same? Are there any obvious points that I can bring
> > up on the subject?
> > Any help on this subject would be much appreciated!
> >
> > Thanks, Cameron Ingram

Re: Stupd question about Struts and EJB.

Posted by Robert Leland <Ro...@free2create.org>.
As far as struts 1.0, the Form bean is used only to redisplay
information to the jsp page. Typically the EJB might be loaded/unloaded in the
action class. If you search www.mail-archives.co,m Craig talked more about this in detail.

In future version of struts this may be enhanced.

-Rob

> Cameron Ingram0 wrote:
> 
> I am in the process of convincing my company to go with MVC and Struts. As with any thing new,
> people are sometimes resistant
> to change. One of the opposition questions I am getting is, how will this work with EJB(problem is
> I don't know too much about EJB currently).  Do the EJB's references just go in the Form and
> Action Bean and every thing else behaves the same? Are there any obvious points that I can bring
> up on the subject?
> Any help on this subject would be much appreciated!
> 
> Thanks, Cameron Ingram

Re: Stupd question about Struts and EJB.

Posted by Jim Richards <gr...@cyber4.org>.
EJBs come in two flavours (as opposed to flavors), session beans and entity
beans.
Session beans represent business logic and rules, entity beans represent a
row in the database.

The model that you'd use is to have Actions do the basic processing of form
elements into data beans (just regular beans, nothing special), but no business
rules.
The Action then calls a session bean with the data bean to do something 
(eg. usdate user details in the database). The session bean connects to the
database with an entity bean (or more than one depending on the database
structure).

Visually, you'd have

JSP     =>      Action  =>      Session Bean    => Entity Bean  => Database

Hope that helps.


At 06:37 AM 27/02/01 -0500, you wrote: 
>
> I am in the process of convincing my company to go with MVC and Struts. As
> with any thing new, people are sometimes resistant 
> to change. One of the opposition questions I am getting is, how will this
> work with EJB(problem is I don't know too much about EJB currently).  Do the
> EJB's references just go in the Form and Action Bean and every thing else
> behaves the same? Are there any obvious points that I can bring up on the
> subject? 
> Any help on this subject would be much appreciated!
>  
> Thanks, Cameron Ingram



--
Kumera - a new Open Source Content Management System
for small to medium web sites written in Perl and using XML
http://www.cyber4.org/kumera/index.html