You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by janbrito <ja...@msn.com> on 2007/02/23 14:47:58 UTC

Best practice

Hi,

I'm building a portal using Struts, Spring, Hibernate and Velocity, and
right now I only have the login action ready. What I would like to know is
how to handle all requests once the user is logged in. Do I have to create
an action class to handle all user clicks on the portal? If the user clicks
on a menu then I would call this main action class passing a parameter
type="menu" and also the id=menuID. If the user clicks in a link within a
menu content, I would call this action class passing type="article" and
id=articleID. Using this methodology I would have a switch to handle the
different types.

Is this a good practice? if not, what would be the best practice?

Thanks
-- 
View this message in context: http://www.nabble.com/Best-practice-tf3278926.html#a9118968
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: [S2] Best practice

Posted by janbrito <ja...@msn.com>.
Thanks for your comments. It makes sense.



Brian Thompson-5 wrote:
> 
> In my web project, I divide actions up logically by what they deal with. 
>   For your menu example, I'd have MenuAction.  For displaying data 
> pages,  I have PageAction.  I also separate management of the various 
> data types out into ManagementAction classes, one for each data type.
> 
> Calling the actions this way is a little easier; I don't need to pass a 
> type, just an ID - the action definitions in struts.xml take care of the 
> rest.  Also, the code ends up being better-organized than if I had one 
> action class to handle all different sorts of actions.
> 
> Good luck!
> 
> -Brian
> 
> 
> 
> janbrito wrote:
>> Hi,
>> 
>> I'm building a portal using Struts, Spring, Hibernate and Velocity, and
>> right now I only have the login action ready. What I would like to know
>> is
>> how to handle all requests once the user is logged in. Do I have to
>> create
>> an action class to handle all user clicks on the portal? If the user
>> clicks
>> on a menu then I would call this main action class passing a parameter
>> type="menu" and also the id=menuID. If the user clicks in a link within a
>> menu content, I would call this action class passing type="article" and
>> id=articleID. Using this methodology I would have a switch to handle the
>> different types.
>> 
>> Is this a good practice? if not, what would be the best practice?
>> 
>> Thanks
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Best-practice-tf3278926.html#a9119714
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Best practice

Posted by Brian Thompson <el...@gmail.com>.
In my web project, I divide actions up logically by what they deal with. 
  For your menu example, I'd have MenuAction.  For displaying data 
pages,  I have PageAction.  I also separate management of the various 
data types out into ManagementAction classes, one for each data type.

Calling the actions this way is a little easier; I don't need to pass a 
type, just an ID - the action definitions in struts.xml take care of the 
rest.  Also, the code ends up being better-organized than if I had one 
action class to handle all different sorts of actions.

Good luck!

-Brian



janbrito wrote:
> Hi,
> 
> I'm building a portal using Struts, Spring, Hibernate and Velocity, and
> right now I only have the login action ready. What I would like to know is
> how to handle all requests once the user is logged in. Do I have to create
> an action class to handle all user clicks on the portal? If the user clicks
> on a menu then I would call this main action class passing a parameter
> type="menu" and also the id=menuID. If the user clicks in a link within a
> menu content, I would call this action class passing type="article" and
> id=articleID. Using this methodology I would have a switch to handle the
> different types.
> 
> Is this a good practice? if not, what would be the best practice?
> 
> Thanks

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