struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Taylor" <rtay...@mulework.com>
Subject RE: Advantages/Disadvantages of One Action for each Use Case
Date Fri, 23 Apr 2004 13:02:12 GMT
I've ended up using something I call XXXXActionUtils classes which contain
common operations. For example if I had a store section in my web application, 
I would have a StoreActionUtils for operations common to Action classes in
the store section.

robert

> -----Original Message-----
> From: Takhar, Sandeep [mailto:Sandeep.Takhar@CIBC.ca]
> Sent: Friday, April 23, 2004 7:22 AM
> To: Struts Users Mailing List
> Subject: RE: Advantages/Disadvantages of One Action for each Use Case
> 
> 
> Do you use subclasses for common methods or do you use helper classes or neither?
> 
> sandeep
> 
> -----Original Message-----
> From: Robert Taylor [mailto:rtaylor@mulework.com]
> Sent: Thursday, April 22, 2004 3:54 PM
> To: Struts Users Mailing List
> Subject: RE: Advantages/Disadvantages of One Action for each Use Case
> 
> 
> +1. 
> 
> I've been down the "option 2" road and things get messy fast.
> I've since switched to the first option and applications scale much
> easier.
> 
> robert
> 
> > -----Original Message-----
> > From: news [mailto:news@sea.gmane.org]On Behalf Of Martin Cooper
> > Sent: Thursday, April 22, 2004 1:52 PM
> > To: user@struts.apache.org
> > Subject: Re: Advantages/Disadvantages of One Action for each Use Case
> > 
> > 
> > There are some major advantages to the first option, especially when you're
> > building a large and/or highly customisable application. A couple of
> > examples:
> > 
> > * It is much easier to reconfigure your application. without needing to
> > change any Java code. You may think you know which "actions" are related
> > today, and what the flow of your application is, but when requirements
> > change later, it's much easier to just change the config than to have to
> > tear up your Action classes and move things around.
> > 
> > * Your struts-config file is much more self-documenting. If you have an
> > Action class that actually handles multiple "actions", then you can't tell
> > from the config file alone which forwards are used by which "actions".
> > Depending on your code, you may have trouble knowing when you can remove a
> > given forward from the config file, since you'd have to check all of the
> > "actions" to see whether or not it is still used.
> > 
> > I've developed large Struts applications using both techniques, and I
> > wouldn't go back, now, to overloading one Action class to do multiple
> > things. I saw the comment from someone else about large numbers of classes,
> > and yes, that can happen, but as long as you're organised and make judicious
> > use of Java packages, it's not a problem.
> > 
> > --
> > Martin Cooper
> > 
> > 
> > "Dionisius Purba" <Dionisius.Purba@mitrais.com> wrote in message
> > news:6FFF6880E67B154AA2467546B2ECEA0048F5CE@tabanan.mitrais.com...
> > > Hi,
> > >
> > > I was wondering what's the advantage and disadvantage of
> > > creating one Action for each use case, i.e. creating
> > > NewAccountAction.java
> > > EditAccountAction.java
> > > or even with NewAccountFormAction.java
> > >
> > > vs
> > >
> > > AccountAction.java
> > > and inside the AccountAction we can check parameter from the JSP
> > > then execute proper method (i.e createNewAccount, editAccount, etc) ?
> > >
> > > Perhaps the first option is similar to GoF's command pattern.
> > > Thanks a lot in advance.
> > > Dion
> > >
> > >
> > > -----Original Message-----
> > > From: David Friedman [mailto:humble@ix.netcom.com]
> > > Sent: Thursday, April 22, 2004 12:42 PM
> > > To: Struts Users Mailing List
> > > Subject: RE: Struts and Hibernate
> > >
> > >
> > > Mario,
> > >
> > > I'm glad to hear it is working.  I couldn't get my properties file to work
> > > with spaces, I had to use equals signs:
> > >
> > > hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect
> > > hibernate.connection.username=XXXXX
> > > hibernate.connection.password=YYYYY
> > > hibernate.connection.url=jdbc:mysql://localhost:3306/test
> > > hibernate.connection.driver_class=com.mysql.jdbc.Driver
> > >
> > > As for your Eclipse problem, if you are using Eclipse v2.1.X (I'm on
> > 2.1.3),
> > > try this: go to the Java perspective, right clicking on the project name,
> > > choose properties, select "Java Build Path", and edit the "Source folders
> > on
> > > build path" entry so
> > > $TOMCAT/webapps/example1/WEB-INF/src becomes
> > > $TOMCAT/webapps/example1/WEB-INF/src/java and make sure the "Default
> > Output
> > > Folder" lists $TOMCAT/webapps/example1/WEB-INF/classes.  That should class
> > > compilation so java files under WEB-INF/src/java compile WEB-INF/classes
> > > instead of showing up under WEB-INF/classes/java.  I.E.
> > > WEB-INF/src/java/com/edhand/whatever.java shows up now (as you described
> > > below) compiled as WEB-INF/classes/java/com/edhand/whatever.java when this
> > > change would make it compile properly as
> > > WEB-INF/classes/com/edhand/whatever.java
> > >
> > > Regards,
> > > David
> > >
> > > -----Original Message-----
> > > From: Mario St-Gelais [mailto:legrimpeur@sympatico.ca]
> > > Sent: Wednesday, April 21, 2004 10:14 PM
> > > To: Struts Users Mailing List
> > > Subject: Re: Struts and Hibernate
> > >
> > >
> > > David Friedman wrote:
> > >
> > > >Mario,
> > > >
> > > >Where is your hibernate.properties file? in WEB-INF/classes or somewhere
> > > >else?
> > > >
> > > >Regards,
> > > >David
> > > >
> > > >-----Original Message-----
> > > >From: Jesse Alexander (KXT) [mailto:alexander.jesse@credit-suisse.com]
> > > >Sent: Wednesday, April 21, 2004 5:09 AM
> > > >To: 'Struts Users Mailing List'
> > > >Subject: RE: Struts and Hibernate
> > > >
> > > >
> > > >could the problem lie beneath the different jdbc-drivers you two guys
> > use?
> > > >Joe, you are using the newest generation mysql-driver. Mario uses the old
> > > >one.
> > > >I also experienced strange stuff using the old one. worked after
> > switching
> > > >to
> > > >the new one...
> > > >
> > > >hth
> > > >Alexander
> > > >
> > > >
> > > >
> > > It is actually working.  Started all over from scratch.  Can't figure
> > > how exactly what went wrong except for one or two things.  Like the
> > > example shows for the property file :
> > >
> > > hibernate.dialect net.sf.hibernate.dialect.MySQLDialect
> > > hibernate.connection.driver_class org.gjt.mm.mysql.Driver
> > > hibernate.connection.driver_class com.mysql.jdbc.Driver
> > > hibernate.connection.url jdbc:mysql:///test
> > > hibernate.connection.username testuser
> > >
> > > See something wrong at line 4!!!!!  Of course I did not see this at
> > first!!!
> > > Should be hibernate.connection.url jdbc:mysql://localhost/test
> > >
> > > As far as it goes for the jdbc driver, I use mysql-connector-java-3.0.9
> > and
> > > no problem there.  So that is something to know I guess.
> > > The Hibernate.properties file is in WEB-INF/classes.
> > >
> > > Also I am not familiar with Ant.  But when using Eclipse like I do, I
> > guess
> > > it is the best way to compile all classes with Eclipse
> > > i.e. it compiles automatically.   But then this here :
> > >
> > >
> > >   12. Create directory |/com/edhand/example1| underneath
> > >       |$TOMCAT/webapps/example1/WEB-INF/src/java|.
> > >
> > > Causes a problem.  Because all packages are com.edhand, and Eclipse
> > > compile in java.com.edhand...
> > >
> > > Since then I also another example known as span.  No success so far.
> > > And I haven't look at it for some days now...
> > >
> > > Mario
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message