You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Irfandhy Franciscus <en...@yahoo.com.sg> on 2004/04/18 19:12:46 UTC

Re: Advantages/Disadvantages of One Action for each Use Case

Well Ravi has raised a good suggestion on using Dispatch Action for this 
case.

I'll try to pointed out the pro n cons for each one. (what i say here 
may not be correct this is just my opinion :P)

Step 1. NewAccountAction.java 
,EditAccountAction.java,NewAccountFormAction.java

If you use this approach, you will eventually end up with hundred of 
classes. Not saying this wrong but imagine what the struts config will 
look like with so many classes.

And sometime it will be harder to maintain the application if the 
youhave too classes.

Step 2. AccountAction.java
What you described in step 2 is what DispatchAction is suppose to do. 
This <a href="http://www.onjava.com/lpt/a/2832"> O'Reilly </a> tutorial 
is a good intro on DispatchAction.


Cheer's
e-null

Dionisius Purba wrote:
> I see. So there are three (3) alternatives that I know then.
> Anybody can point the pro/cons of each one?
> 
> ~Dion~
> 
> -----Original Message-----
> From: Ravi Kulkarni [mailto:rkulkarni@applabs.net]
> Sent: Thursday, April 22, 2004 1:15 PM
> To: Struts Users Mailing List
> Subject: RE: Advantages/Disadvantages of One Action for each Use Case
> 
> 
> DispatchAction is what exactly is meant for these kinds of situations.
> 
> Kulkarni.
> 
> 
>>-----Original Message-----
>>From: Dionisius Purba [mailto:Dionisius.Purba@mitrais.com]
>>Sent: Thursday, April 22, 2004 10:43 AM
>>To: 'Struts Users Mailing List'
>>Subject: Advantages/Disadvantages of One Action for each Use Case
>>
>>
>>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