You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vincent Stoessel <vi...@xaymaca.com> on 2002/05/29 18:08:03 UTC

New to Struts

Hello,
I have been using forte CE as my main IDE for developing my java and jsp
applications. The concept behind struts sounds great as I want to move 
toward a more standand templates/framework for my web based 
applications. My taglib experience has been very small and my EJB 
experience is still in the book reading phase. Does forte CE
work well with struts or am I better off just using xemecs/jde
to edit files by hand. Thanks.
-- 
Vincent Stoessel
Linux Systems Developer
vincent xaymaca.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: New to Struts

Posted by Vincent Stoessel <vi...@xaymaca.com>.
Truly cool, it's running sweet in forte 3.0 CE.

OK, time for the slow part, reading the struts docs.
:)

Thank You



James Holmes wrote:
> Forte CE and NetBeans are good tools for working with
> Struts.  Currently the Struts Console plugs into both
> of the IDEs.
> 
> Struts Console:
> http://www.jamesholmes.com/struts/
> 
> I'm working with some folks at Sun to bring better
> Struts support into both of these IDEs. This should
> add alot of needed development support tools.
> 




>>
>>
>>--
>>To unsubscribe, e-mail:  
>><ma...@jakarta.apache.org>
>>For additional commands, e-mail:
>><ma...@jakarta.apache.org>
>>
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>



-- 
Vincent Stoessel
Linux Systems Developer
vincent xaymaca.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: New to Struts

Posted by James Holmes <jh...@yahoo.com>.
Forte CE and NetBeans are good tools for working with
Struts.  Currently the Struts Console plugs into both
of the IDEs.

Struts Console:
http://www.jamesholmes.com/struts/

I'm working with some folks at Sun to bring better
Struts support into both of these IDEs. This should
add alot of needed development support tools.

-james
james@jamesholmes.com

--- Vincent Stoessel <vi...@xaymaca.com> wrote:
> Hello,
> I have been using forte CE as my main IDE for
> developing my java and jsp
> applications. The concept behind struts sounds great
> as I want to move 
> toward a more standand templates/framework for my
> web based 
> applications. My taglib experience has been very
> small and my EJB 
> experience is still in the book reading phase. Does
> forte CE
> work well with struts or am I better off just using
> xemecs/jde
> to edit files by hand. Thanks.
> -- 
> Vincent Stoessel
> Linux Systems Developer
> vincent xaymaca.com
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Design Advice - Relational Databases & Java Objects

Posted by Adam Hardy <ad...@cyberspaceroad.com>.
>
>
>As mentioned elsewhere, getting a database connection from the web tier
>is not a good practice. The Struts framework does try to encourage best
>practice but sometimes takes a dip in the pool of pragmatism. The
>Generic Connection pool is one example of this. The data access objects
>should take care of all the connection stuff and just pass back standard
>Java objects like JavaBeans and Collections. The web tier, and even
>business tier, does not need to know where the data comes from. 
>  
>
If the data access objects completely encapsulate the connection stuff, 
how does the business object wrap two calls to the data access layer in 
one transaction?  Take for example the well-worn credit and debit 
financial transaction. Would you wrap that up into one data access 
object and say OK, we've got two operations rolled into one and we can't 
seperate them and re-use them, but that's necessary for a transaction?

On the other hand, if the data access objects are handed the connection 
by the business object, or if the connection came from the struts 
connection pool, then the transaction could be handled easily I know. Am 
I chasing a Holy Grail here?

Adam


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Design Advice - Relational Databases & Java Objects

Posted by Ted Husted <hu...@apache.org>.
> (1) Is it best for the data access layer to throw exceptions on error to
> be picked up by the business objects & then struts actions, or would it
> be good to use a struts-type message object and use strings in the
> application resources file (I'm just worried my exceptions' text would
> not be multi-lingual)

In the event of a real emergency, the data access layer should throw
exceptions, which your business layer can catch. I find chaining
exceptions to be very effective. 

http://www.javaworld.com/javaworld/jw-08-2001/jw-0803-exceptions.html

You can add your own business explanationa at the top of the chain and
show both the business explantion and the actual cause. The business
explanation calms the mere mortals and the actual cause helps tech
support with problem determination. 

The Struts message system builds on the standard Java ResourceBundle
framework. So I would say that it is perfectly valid for your business 
objects to return tokens from the ApplicationResource file. This file 
can be used in any application and is not Struts-specific. (Especially 
if you are using the message tags from Struts 1.1b or 1.0 version of 
the Validator.)

If you really want to hedge your bets, write your own business layer
first. This layer takes the input each business operation requires and
hands back a Collection, Object, or maybe just a status code.
Internally, the business layer takes the input and connects to the data
access layer (JDBC, Castor, Turbine, whatever). This can also let you
chain the exceptions or do whatever other handling you need to make.
Your business layer becomes bound to the data access layer but can be
changed without touching the web tier. 

This also makes it easy to use multiple data access devices. You might
need to use Castor for some things and Lucene for others. The business
layer can provide a consistent interface to the application platform
(Struts, Swing, whatever), and then choose whatever source it wants to
use for data. This would also include manufacturing data for testing or
debugging.

Chapter 12 and 13 of Professional JSP Site Design from Wrox show using 
this approach for JDBC and then integrating Lucene for some of the 
searches. Struts is used by the example application here, as it is 
throughout most of the book. 

http://jakarta.apache.org/struts/resources.html#books
(4th from the top)

The Action's role is to bundle the input from the ActionForm bean into
whatever input the business layer expects. The Action then either
forward the result along or cope with any error condition.


> (2) How would I get the database connection info to the data access
> layer? Presuming I want to set it up in struts-config.xml or as in
> commons-dbcp, would I then pass it in from struts actions into the
> business object and then into the data access layer as a parameter on
> each call?


As mentioned elsewhere, getting a database connection from the web tier
is not a good practice. The Struts framework does try to encourage best
practice but sometimes takes a dip in the pool of pragmatism. The
Generic Connection pool is one example of this. The data access objects
should take care of all the connection stuff and just pass back standard
Java objects like JavaBeans and Collections. The web tier, and even
business tier, does not need to know where the data comes from. 

-- Ted Husted, Husted dot Com, Fairport NY US
-- Developing Java Web Applications with Struts
-- Tel: +1 585 737-3463
-- Web: http://husted.com/about/services


Adam Hardy wrote:
> 
> Hi All,
> 
> I saw this thread in the archives and I thought I'd pinch the title.
> I've spent this afternoon surfing the web looking at stuff on Sun,
> Jakarta  and lots of smaller sites looking for a ready-made data access
> layer package but I take it there isn't an open-source one out there.
> 
> Obviously I don't want to tie my data access layer to struts, so there
> are a few questions I've got.
> 
> (1) Is it best for the data access layer to throw exceptions on error to
> be picked up by the business objects & then struts actions, or would it
> be good to use a struts-type message object and use strings in the
> application resources file (I'm just worried my exceptions' text would
> not be multi-lingual)
> 
> (2) How would I get the database connection info to the data access
> layer? Presuming I want to set it up in struts-config.xml or as in
> commons-dbcp, would I then pass it in from struts actions into the
> business object and then into the data access layer as a parameter on
> each call?
> 
> I've seen quite a few patterns like www.martinfowler.com and code like
> in Sun's Pet Store, so I think I've got a fairly good idea of what I
> need. The data access layer I want has got to:
> 
> - take as input and return as output Data Transport Objects
> - allow the business objects to control transactions
> - use a connection pool
> - possibly keep the SQL statements in an external XML file
> - have comprehensive error handling & reporting
> 
> --
> 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>


Re: Design Advice - Relational Databases & Java Objects

Posted by Jin Bal <ji...@hotmail.com>.
IMHO
It's better that any db access layer does not know "how" to get a database
connection,  it just gets given them by the client calling it.  This way if
you need to change the way you grab db connections the db access layer is
none the wiser and no code changes are needed

Jin
----- Original Message -----
From: "Adam Hardy" <ad...@cyberspaceroad.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, May 29, 2002 5:44 PM
Subject: Design Advice - Relational Databases & Java Objects


> Hi All,
>
> I saw this thread in the archives and I thought I'd pinch the title.
> I've spent this afternoon surfing the web looking at stuff on Sun,
> Jakarta  and lots of smaller sites looking for a ready-made data access
> layer package but I take it there isn't an open-source one out there.
>
> Obviously I don't want to tie my data access layer to struts, so there
> are a few questions I've got.
>
> (1) Is it best for the data access layer to throw exceptions on error to
> be picked up by the business objects & then struts actions, or would it
> be good to use a struts-type message object and use strings in the
> application resources file (I'm just worried my exceptions' text would
> not be multi-lingual)
>
> (2) How would I get the database connection info to the data access
> layer? Presuming I want to set it up in struts-config.xml or as in
> commons-dbcp, would I then pass it in from struts actions into the
> business object and then into the data access layer as a parameter on
> each call?
>
>
>
> I've seen quite a few patterns like www.martinfowler.com and code like
> in Sun's Pet Store, so I think I've got a fairly good idea of what I
> need. The data access layer I want has got to:
>
> - take as input and return as output Data Transport Objects
> - allow the business objects to control transactions
> - use a connection pool
> - possibly keep the SQL statements in an external XML file
> - have comprehensive error handling & reporting
>
>
>
>
> --
> 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>


Re: Design Advice - Relational Databases & Java Objects

Posted by Adam Hardy <ad...@cyberspaceroad.com>.
Hello Jerome,
I'm not sure why I'm so bad at searching the net & not finding things 
like this. ObjectBridge has a feature list that blows me away. Are you 
using it? Castor also looks interesting.

Why do you refer me to JBoss & openEJB? I've no experience with EJB, but 
from what I know, I presume you mean that I could use these EJB 
containers for their container managed persistence mechanisms - would 
they fulfill the requirements of a data access layer?

Thanks
Adam



Jerome Jacobsen wrote:

>Have you looked at these opensource projects?
>
>JBoss http://www.jboss.org/
>OpenEJB http://www.openejb.org/
>Castor JDO http://castor.exolab.org/
>ObjectRelationalBridge http://objectbridge.sourceforge.net/
>
>As for (1) I would have the business objects throw exceptions.  I would have
>the Struts Action convert exceptions to ActionErrors or ActionMessages as
>appropriate.
>
>As for (2) the answer depends on the capabilities of the data-access layer
>you are using.
>
>-----Original Message-----
>From: Adam Hardy [mailto:adam.hardy@cyberspaceroad.com]
>Sent: Wednesday, May 29, 2002 12:44 PM
>To: Struts Users Mailing List
>Subject: Design Advice - Relational Databases & Java Objects
>
>
>Hi All,
>
>I saw this thread in the archives and I thought I'd pinch the title.
>I've spent this afternoon surfing the web looking at stuff on Sun,
>Jakarta  and lots of smaller sites looking for a ready-made data access
>layer package but I take it there isn't an open-source one out there.
>
>Obviously I don't want to tie my data access layer to struts, so there
>are a few questions I've got.
>
>(1) Is it best for the data access layer to throw exceptions on error to
>be picked up by the business objects & then struts actions, or would it
>be good to use a struts-type message object and use strings in the
>application resources file (I'm just worried my exceptions' text would
>not be multi-lingual)
>
>(2) How would I get the database connection info to the data access
>layer? Presuming I want to set it up in struts-config.xml or as in
>commons-dbcp, would I then pass it in from struts actions into the
>business object and then into the data access layer as a parameter on
>each call?
>
>
>
>I've seen quite a few patterns like www.martinfowler.com and code like
>in Sun's Pet Store, so I think I've got a fairly good idea of what I
>need. The data access layer I want has got to:
>
>- take as input and return as output Data Transport Objects
>- allow the business objects to control transactions
>- use a connection pool
>- possibly keep the SQL statements in an external XML file
>- have comprehensive error handling & reporting
>
>
>
>
>--
>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>
>
>
>  
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Design Advice - Relational Databases & Java Objects

Posted by Jerome Jacobsen <je...@gentootech.com>.
Have you looked at these opensource projects?

JBoss http://www.jboss.org/
OpenEJB http://www.openejb.org/
Castor JDO http://castor.exolab.org/
ObjectRelationalBridge http://objectbridge.sourceforge.net/

As for (1) I would have the business objects throw exceptions.  I would have
the Struts Action convert exceptions to ActionErrors or ActionMessages as
appropriate.

As for (2) the answer depends on the capabilities of the data-access layer
you are using.

-----Original Message-----
From: Adam Hardy [mailto:adam.hardy@cyberspaceroad.com]
Sent: Wednesday, May 29, 2002 12:44 PM
To: Struts Users Mailing List
Subject: Design Advice - Relational Databases & Java Objects


Hi All,

I saw this thread in the archives and I thought I'd pinch the title.
I've spent this afternoon surfing the web looking at stuff on Sun,
Jakarta  and lots of smaller sites looking for a ready-made data access
layer package but I take it there isn't an open-source one out there.

Obviously I don't want to tie my data access layer to struts, so there
are a few questions I've got.

(1) Is it best for the data access layer to throw exceptions on error to
be picked up by the business objects & then struts actions, or would it
be good to use a struts-type message object and use strings in the
application resources file (I'm just worried my exceptions' text would
not be multi-lingual)

(2) How would I get the database connection info to the data access
layer? Presuming I want to set it up in struts-config.xml or as in
commons-dbcp, would I then pass it in from struts actions into the
business object and then into the data access layer as a parameter on
each call?



I've seen quite a few patterns like www.martinfowler.com and code like
in Sun's Pet Store, so I think I've got a fairly good idea of what I
need. The data access layer I want has got to:

- take as input and return as output Data Transport Objects
- allow the business objects to control transactions
- use a connection pool
- possibly keep the SQL statements in an external XML file
- have comprehensive error handling & reporting




--
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>


Design Advice - Relational Databases & Java Objects

Posted by Adam Hardy <ad...@cyberspaceroad.com>.
Hi All,

I saw this thread in the archives and I thought I'd pinch the title. 
I've spent this afternoon surfing the web looking at stuff on Sun, 
Jakarta  and lots of smaller sites looking for a ready-made data access 
layer package but I take it there isn't an open-source one out there.

Obviously I don't want to tie my data access layer to struts, so there 
are a few questions I've got.

(1) Is it best for the data access layer to throw exceptions on error to 
be picked up by the business objects & then struts actions, or would it 
be good to use a struts-type message object and use strings in the 
application resources file (I'm just worried my exceptions' text would 
not be multi-lingual)

(2) How would I get the database connection info to the data access 
layer? Presuming I want to set it up in struts-config.xml or as in 
commons-dbcp, would I then pass it in from struts actions into the 
business object and then into the data access layer as a parameter on 
each call?



I've seen quite a few patterns like www.martinfowler.com and code like 
in Sun's Pet Store, so I think I've got a fairly good idea of what I 
need. The data access layer I want has got to:

- take as input and return as output Data Transport Objects
- allow the business objects to control transactions
- use a connection pool
- possibly keep the SQL statements in an external XML file
- have comprehensive error handling & reporting




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: New to Struts

Posted by Brad Rhoads <br...@zethcon.com>.
I've been using Forte CE w/ struts 1.0. Works OK, but I haven't gotten the
debugger going yet. And I have the .java & .class files in the same
directories. I know you can set up to compile to different directories, but
I haven't taken the time to figure it out yet.

-----Original Message-----
From: Vincent Stoessel [mailto:vincent@xaymaca.com]
Sent: Wednesday, May 29, 2002 11:08 AM
To: Struts Users
Subject: New to Struts


Hello,
I have been using forte CE as my main IDE for developing my java and jsp
applications. The concept behind struts sounds great as I want to move
toward a more standand templates/framework for my web based
applications. My taglib experience has been very small and my EJB
experience is still in the book reading phase. Does forte CE
work well with struts or am I better off just using xemecs/jde
to edit files by hand. Thanks.
--
Vincent Stoessel
Linux Systems Developer
vincent xaymaca.com


--
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>