You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by James Reynolds <Ja...@intermountainmail.org> on 2006/03/13 23:13:25 UTC

[Shale] Creating my Managed Bean template

I'm about to set up a template file for managed-beans and I was planning
on inserting the methods supported by the ViewController interface.

My question is, does it hurt to have empty ViewController methods in the
bean if I'm not using them?  If, for some reason, I'm not using the
init() method, should I remove it from the file to avoid confusing
Shale?

Thanks


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


Re: [Shale] Creating my Managed Bean template

Posted by Craig McClanahan <cr...@apache.org>.
On 3/13/06, James Reynolds <Ja...@intermountainmail.org> wrote:
>
>
> I'm about to set up a template file for managed-beans and I was planning
> on inserting the methods supported by the ViewController interface.
>
> My question is, does it hurt to have empty ViewController methods in the
> bean if I'm not using them?  If, for some reason, I'm not using the
> init() method, should I remove it from the file to avoid confusing
> Shale?


If your backing bean "implements ViewController" then you are going to be
*required* to implement all the methods (even if they are empty) to avoid
compile errors.

The simplest thing to do is "extends AbstractViewController".  Besides the
fact that this class implements (as empty methods) all the callbacks, so you
only have to override the ones you care about, it also offers you a bunch of
useful helper methods too.

Thanks


Craig