You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Alen Ribic <al...@mweb.co.za> on 2003/06/17 09:36:17 UTC

Same boring copy/paste technique

Hi Everyone,

I have many functions in my system that are to be very similar in their
actions, forms and view pages.
What is the best way of going about generating a common template for these
functions at least from view perspective.
Of course as long as this is to make my life easier not more difficult
otherwise I'll stick to copy/paste pattern. :)

--Alen


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


RE: Same boring copy/paste technique

Posted by Filip Polsakiewicz <Fi...@innoface.de>.

> -----Original Message-----
> From: Alen Ribic [mailto:alenr@mweb.co.za]
> Sent: Tuesday, June 17, 2003 10:03 AM
> To: Struts Users Mailing List
> Subject: Re: Same boring copy/paste technique
>
>
> thanks Filip for your reply.
>
> For the actions and forms, abstraction will definitely do the
> trick in many
> places for me.
> As for view, I'm looking into Struts tiles.

tiles actually does abstraction too. Using definitions works fine with most
problems

Good luck

Filip
>
> --Alen
>
>
> ----- Original Message -----
> From: "Filip Polsakiewicz" <Fi...@innoface.de>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Tuesday, June 17, 2003 9:47 AM
> Subject: RE: Same boring copy/paste technique
>
>
> >
> >
> > > -----Original Message-----
> > > From: Alen Ribic [mailto:alenr@mweb.co.za]
> > > Sent: Tuesday, June 17, 2003 9:36 AM
> > > To: Struts Users Mailing List
> > > Subject: Same boring copy/paste technique
> > >
> > >
> > > Hi Everyone,
> > >
> > > I have many functions in my system that are to be very
> similar in their
> > > actions, forms and view pages.
> > > What is the best way of going about generating a common template for
> these
> > > functions at least from view perspective.
> >
> > For Forms and Actions you might want to create an abstract BaseAction or
> > BaseForm that defines the common methods and field and then extend it
> > as you need it. Something like:
> >
> > public abstract class UserAction {...}
> >
> > and then
> >
> > public abstract class UserCreateAction {...}
> >
> > same thing with forms.
> > The Advantage over copy&paste is that if anything changes you don't need
> to
> > change it in all files.
> >
> > For the view part: take a look at struts-tiles. that could solve your
> > problem.
> >
> > Filip
> >
> > > Of course as long as this is to make my life easier not more difficult
> > > otherwise I'll stick to copy/paste pattern. :)
> > >
> > > --Alen
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


Re: Same boring copy/paste technique

Posted by Alen Ribic <al...@mweb.co.za>.
thanks Filip for your reply.

For the actions and forms, abstraction will definitely do the trick in many
places for me.
As for view, I'm looking into Struts tiles.

--Alen


----- Original Message -----
From: "Filip Polsakiewicz" <Fi...@innoface.de>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Tuesday, June 17, 2003 9:47 AM
Subject: RE: Same boring copy/paste technique


>
>
> > -----Original Message-----
> > From: Alen Ribic [mailto:alenr@mweb.co.za]
> > Sent: Tuesday, June 17, 2003 9:36 AM
> > To: Struts Users Mailing List
> > Subject: Same boring copy/paste technique
> >
> >
> > Hi Everyone,
> >
> > I have many functions in my system that are to be very similar in their
> > actions, forms and view pages.
> > What is the best way of going about generating a common template for
these
> > functions at least from view perspective.
>
> For Forms and Actions you might want to create an abstract BaseAction or
> BaseForm that defines the common methods and field and then extend it
> as you need it. Something like:
>
> public abstract class UserAction {...}
>
> and then
>
> public abstract class UserCreateAction {...}
>
> same thing with forms.
> The Advantage over copy&paste is that if anything changes you don't need
to
> change it in all files.
>
> For the view part: take a look at struts-tiles. that could solve your
> problem.
>
> Filip
>
> > Of course as long as this is to make my life easier not more difficult
> > otherwise I'll stick to copy/paste pattern. :)
> >
> > --Alen
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


RE: Same boring copy/paste technique

Posted by Filip Polsakiewicz <Fi...@innoface.de>.

> -----Original Message-----
> From: Alen Ribic [mailto:alenr@mweb.co.za]
> Sent: Tuesday, June 17, 2003 9:36 AM
> To: Struts Users Mailing List
> Subject: Same boring copy/paste technique
>
>
> Hi Everyone,
>
> I have many functions in my system that are to be very similar in their
> actions, forms and view pages.
> What is the best way of going about generating a common template for these
> functions at least from view perspective.

For Forms and Actions you might want to create an abstract BaseAction or
BaseForm that defines the common methods and field and then extend it
as you need it. Something like:

public abstract class UserAction {...}

and then

public abstract class UserCreateAction {...}

same thing with forms.
The Advantage over copy&paste is that if anything changes you don't need to
change it in all files.

For the view part: take a look at struts-tiles. that could solve your
problem.

Filip

> Of course as long as this is to make my life easier not more difficult
> otherwise I'll stick to copy/paste pattern. :)
>
> --Alen
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


Re: Same boring copy/paste technique

Posted by Alen Ribic <al...@mweb.co.za>.
Hi Andrew

Aaaa, nice.
It seems like I haven't looked through all the features that Struts has to
offer.
I'm reading through tiles feature now and it sounds like it will do the job
from view perspective.

Thanks
--Alen



----- Original Message -----
From: "Andrew Hill" <an...@gridnode.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Tuesday, June 17, 2003 9:43 AM
Subject: RE: Same boring copy/paste technique


> You would probably benefit from investing some time into trying to learn
> tiles.
>
> -----Original Message-----
> From: Alen Ribic [mailto:alenr@mweb.co.za]
> Sent: Tuesday, 17 June 2003 15:36
> To: Struts Users Mailing List
> Subject: Same boring copy/paste technique
>
>
> Hi Everyone,
>
> I have many functions in my system that are to be very similar in their
> actions, forms and view pages.
> What is the best way of going about generating a common template for these
> functions at least from view perspective.
> Of course as long as this is to make my life easier not more difficult
> otherwise I'll stick to copy/paste pattern. :)
>
> --Alen
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


RE: Same boring copy/paste technique

Posted by Andrew Hill <an...@gridnode.com>.
You would probably benefit from investing some time into trying to learn
tiles.

-----Original Message-----
From: Alen Ribic [mailto:alenr@mweb.co.za]
Sent: Tuesday, 17 June 2003 15:36
To: Struts Users Mailing List
Subject: Same boring copy/paste technique


Hi Everyone,

I have many functions in my system that are to be very similar in their
actions, forms and view pages.
What is the best way of going about generating a common template for these
functions at least from view perspective.
Of course as long as this is to make my life easier not more difficult
otherwise I'll stick to copy/paste pattern. :)

--Alen


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


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