You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by wb...@Ensign-BickfordInd.com on 2002/07/02 19:44:22 UTC
Wow - Continued...
Okay, here is answering the questions on what it was I did...
Disclaimer: I am new at Struts and web apps so if there is a better way
to do something I want to hear it. Really. Getting all this working at
once was a pretty steep learning curve.
------------------------------------------------------------------------
-------------------------------------------
The Display Tag library ( http://edhill.its.uiowa.edu/display/ )
This was the best one I could find for it, although the documentation is
somewhat lacking and required some source diving to learn that I could
do grouping and such. It supports Dynabeans and does all kinds of nice
looking things... I could go into it all now, but if you go to the web
site its all already described.
In the JSP it looks like this
<display:table width="95%" name="results" >
<display:column property="id" title="Request" href="viewRequest.do"
paramId="idnum" paramProperty="id"/>
<display:column property="vendorCompanyName" title="Vendor"
href="viewRequest.do" paramId="idnum" paramProperty="id"/>
<display:column property="startDate" title="Starting" />
<display:column property="endDate" title="Ending"/>
<display:column property="employeeLastName" title="Requested By"/>
<display:column property="campus" title="Campus" />
</display:table>
It also works well with CSS proving both a default style to use and also
you can override it on a column basis
The top two columns build links in the display which is cool. It also
does grouping (not shown) which was something else I needed
Supports paging, XML, CSV and Text output, etc...
_________________________________________________________________
DAO Layer
This layer is home grown and pretty simple. I have the following levels
in the app:
Action
Busness Logic
specificDAO
baseDAO
The action layer makes calls to the business logic to determing what
data should be returned. It gets and passes down a DATASOURCE it gets
from the struts config. This is how I avoid keeping everything below
here unaware of the servlet running it. the business logic determines
what it needs and makes a call to the specificDAO for this part of the
app for instance:
Business Logic to SpecificDAO: getProjectList( )
The SpecificDAO builds the SQL query and calls a method in the baseDAO
which it extends called executeQuery
The ExecuteQuery takes the SQL, gets a connection based on the
Datasource and executes the SQL. It then takes the result set and
using the column names in the metadata creates a Dynabean for each of
the rows containing properties for all of the fields. It returns an
ArrayList which bubbles up the Action. That stuffs it into the session
and the JSP page will be able to display it using the taglib above. I
also have a variant of this which allows a bean to be passed down
through the DAO which the execute then uses instead of a DynaBean.
------------------------------------------------------------------------
--------------------------------------------------------------------
DynaForms / Validator
These little gems save me the trouble of making a ton of beans and
coding alot of validation routines. I use them for all the forms and to
do all the validation. I am using the action to handle any excessive
validation I need to do. The config files start getting a little big,
but I think that you can split up config files now... I have to look
into that.
------------------------------------------------------------------------
--------------------------------------------------------------------
Tiles
This kicked ass. I am building a series of applications for our
intranet so I want to maintain the same look and feel. I have a common
directory of tiles and definitions that I copy from one project to the
next and simply override the definitions that apply to the current
application. In this app I will take the common look and override stuff
like:
* RegionalNavigationBlock
* RegionalTitle
* RegionalFooter
* Body
I can basically have a whole new framework up in a few minutes (HTML
anyway).
------------------------------------------------------------------------
--------------------------------------------------------------------
ANT
You gotta love ANT. I use ant for all my compilation, but also to
concatinate all of the properties files together into one so that I only
need one referenced in the config file. Keeps it easy to work with
cause I never have to deal with the whole file at once...
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Wow - Continued...
Posted by Joe Celentano <li...@joecelentano.com>.
> -----Original Message-----
> From: wbchmura@Ensign-BickfordInd.com
> -------------------------------------------
> The Display Tag library ( http://edhill.its.uiowa.edu/display/ )
> This was the best one I could find for it, although the documentation is
> somewhat lacking and required some source diving to learn that I could
> do grouping and such. It supports Dynabeans and does all kinds of nice
> looking things... I could go into it all now, but if you go to the web
> site its all already described.
Ed had a BOF at JavaOne this year to sort of show how he came up with that
tag lib and how it works. It's very straightforward, easy to use, and easy
to modify. I've already added a bunch of features that I'm going to submit
back to him, and they all were extremely easy to implement. If anybody has a
table tag they are in love with that seems like it's better than this, I'd
love to hear about it!
Joe
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>