You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bomb Diggy <te...@yahoo.com> on 2002/09/23 10:01:30 UTC
Question on EJB/Session Bean usage from Action class, and some rants...
1) I plan on using Session beans to hit DB directly
using JDBC, and also to work with entity beans. To
provide transaction safety, it seems like my Action
classes would be able to provide, at most, a simple
pass-through of data (maybe a value/transfer object)
to a single session bean method. If I called more
than one session bean, then I'd be busting-up the
transaction, right? Example below:
public ActionForward perform(
ActionMapping mapping,
ActionForm form_,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
// Get your form data
MyActionForm form = (MyActionForm) form_;
// Locate/get remote reference to your EJB SB
EJBSessionBean sb = getMySessionBean();
// Update some db data through your session bean
ValueObjectBean vob1 =
sb.updateDataSource( form );
// Wouldn't this break xactional integrity??
ValueObjectBean vob2 =
sb.updateSomeOtherDataSource( form );
// Make VOBs available to JSP
request.setAttribute( "VOB1", vob1 );
request.setAttribute( "VOB2", vob2 );
// Send 'em to the next JSP
return mapping.findForward( UPDATED_PAGE );
}
2) Does anyone use ActionForms for validation?
--------------------------------------------------
I will do all of my form validation on the client
side - using Javascript. The only reason I'd use
an ActionForm to do validation is possibly to
improve security in case a would-be hacker decides
to have a little fun. But even then, it seems a
waste. ActionForms *do* seem like a good way to
get HTML data into a digestable form (pi), and I
guess they play a part in redisplaying data should
something later on down the line (maybe in the EJB
layer) goes sour (dupe PK). But what am I missing
about ActionForms and the much-balleyhooed
'validation' they provide?
3) Should an EJB Session Bean ever be used as
anything other than a 'Facade'?
----------------------------------------------------
Is it asking too much for people to not throw around
these design pattern words and append them to the
names of all their classes unless they actually
intend them to *mean* something. Pick one: Session
Beans, or Facade Beans - but not Session Facade
Beans, nor Facade Session Beans. I'm leaving it
up to y'all. Do the right thing.
4) Why is everyone concerned with having 15+
'layers' of architecture?
-----------------------------------------------------
People - the number of lines of code never indicated
quality, nor does the number of layers in your
architecture. In fact, more times than not, I'd say
the number of layers one employs is inversely
proportional to one's level of self-confidence.
Now, run along good little sheep.
Thanks for the mic...
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Question: Clean shutdown of application scope objects
Posted by Robert Taylor <rt...@mulework.com>.
Look at javax.ServletContextListener. The web app calls these objects when
it shutsdown.
robert
> -----Original Message-----
> From: Tal Rotbart [mailto:struts@opisphere.com]
> Sent: Monday, September 23, 2002 6:47 AM
> To: struts-user@jakarta.apache.org
> Subject: Question: Clean shutdown of application scope objects
>
>
> Hi All,
>
> I'm a new Struts user, and I've been trying to figure out how to make sure
> that my model's clean shutdown is called when the webapp is shutdown when
> using Struts. With a regular servlet, it's quite easy -- just override
> "destroy()" and put the clean-up call there, but in Struts I can't seem to
> find how to do so.
>
> In Struts 1.1 I've been told it has to do with the new RequestProcessor
> class, but I'm not sure how to use it and the documentation in the JavaDoc
> doesn't give a clue...
>
> I anyone can offer any help, I'd appreciate it.
>
> Thanks,
> Tal
>
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Question: Clean shutdown of application scope objects
Posted by Tal Rotbart <st...@opisphere.com>.
Hi All,
I'm a new Struts user, and I've been trying to figure out how to make sure
that my model's clean shutdown is called when the webapp is shutdown when
using Struts. With a regular servlet, it's quite easy -- just override
"destroy()" and put the clean-up call there, but in Struts I can't seem to
find how to do so.
In Struts 1.1 I've been told it has to do with the new RequestProcessor
class, but I'm not sure how to use it and the documentation in the JavaDoc
doesn't give a clue...
I anyone can offer any help, I'd appreciate it.
Thanks,
Tal
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>