>From: "James Reynolds" <[EMAIL PROTECTED]> 
>
> 
> 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? 

Not at all.  Here's an example: 
http://svn.apache.org/viewcvs.cgi/struts/shale/trunk/core-library/src/java/org/apache/shale/view/AbstractViewController.java?rev=344322&view=log

>If, for some reason, I'm not using the 
> init() method, should I remove it from the file to avoid confusing 
> Shale? 
> 

If you are implementing the ViewController interface, you will have to provide 
implementation for all of the methods.  

Another option is to extend the AbstractViewController and then you only need 
to override the methods you are interested in implementing.  

If java 1.5 is an option, the shale tiger annotation library is pretty slick.  
You can use annotations to define the view controller call backs.  You can also 
choose your own method names.  For example:

@Bean(name="dataTable", scope=Scope.SESSION)
@View public class DataTableBean  {
    
 @Prerender public void loadPeople() {
  people = new ArrayList();
  for (int i = 0; i < 10; i++) {
   BasicPerson person = new BasicPerson();
   person.setFirstName("First" + i);
   person.setLastName("Last" + (10 - i));
   people.add(person);
  }
 }
 
 private List people = null;
 public List getPeople() {
    return people;
 }
 
}



Gary


> Thanks 
> 
> 
> --------------------------------------------------------------------- 
> To unsubscribe, e-mail: [EMAIL PROTECTED] 
> For additional commands, e-mail: [EMAIL PROTECTED] 
> 

Reply via email to