my responses inline below...

On Wed, Feb 12, 2014 at 9:53 AM, mauro2java2011 <[email protected]>wrote:

> @Named(value = "mauroController")
> @SessionScoped
> public class MauroController implements Serializable {
>
>
> private ConsultDTO current;
>
>
<snip>


> private List<ConsultDTO> list=new ArrayList<ConsultDTO>();
>

</snip>

My recommendation is to define the 'list'

private List<ConsultDTO> list;


>     /**
>      * Creates a new instance of MauroController
>      */
>     public MauroController() {
>     }
>

<snip>


>      @PostConstruct
>     public void init(){
>         if (current==null){
>             current = new ConsultDTO();
>         }
>

</snip>

and instantiate your list in @PostConstruct or somewhere in your bean
'after' @PostConstruct, depending on your app, use case(s), etc...

list=new ArrayList<ConsultDTO>();


just like you are instantiating other bean members 'below' in
@PostConstruct,



>
>
>     ConsultDTO c1, c2 ,c3 ,c4;
>     c1= new ConsultDTO("a");
>     c2=  new ConsultDTO("b");
>     c3= new ConsultDTO("c");
>     c4= new ConsultDTO("d");
>     c1.setDescription("first description");
>     c2.setDescription("second description");
>     c3.setDescription("terza descrione");
>     c4.setDescription("4 descrizione");
>     this.list.add(c1);
>     this.list.add(c2);
>     this.list.add(c3);
>     this.list.add(c4);
>
>     }
>

Reply via email to