How to fill SeparatorList or FormList

Last updated 8 months ago

This page shows two ways how to fill separatorlist or Formlist

Java

To do this, all we have to do is the same step shown above, except in step 2 ... instead of the above code, put this code, with a small detail, the class Teste is a DAO class created earlier (click here to see how do that) [Fig. Class DAO]

public Response actionIndex() throws IOException, IllegalArgumentException, IllegalAccessException{
Page_home model = new Page_home();
model.load();
Page_homeView view = new Page_homeView();
/*----#start-code(index)----*/
Teste teste = new Teste();
List<Teste> lista_teste = teste.findAll();
ArrayList<Page_home.Separatorlist_1> lista_final = new ArrayList<>();
for(Teste lista: lista_teste) {
Page_home.Separatorlist_1 separa = new Page_home.Separatorlist_1();
separa.setMae(new Pair(lista.getMae(),lista.getMae()));
separa.setPai(new Pair(lista.getPai(),lista.getPai()));
separa.setIdade(new Pair(lista.getIdade()+"",lista.getIdade()+""));
separa.setNome(new Pair(lista.getNome(),lista.getNome()));
lista_final.add(separa);
}
model.setSeparatorlist_1(lista_final);
/*----#end-code----*/
view.setModel(model);
return this.renderView(view);
}

Class DAO Teste

SQL

Step 1: First of all, create your application and connect to your database, create your page and put a separator list [Fig. 1]

[Fig. 1] PAge

Step 2: Then, click "JAVA" and your controller put this code below, specify your connection name [ex. teste_isac_pg_1] and your select [ex. SELECT nome as nome, pai as nome_de_pai, mae as nome_da_mae, idade as idade FROM public.teste]

public class Insert_fotoController extends Controller {
public Response actionIndex() throws IOException, IllegalArgumentException, IllegalAccessException{
Insert_foto model = new Insert_foto();
model.load();
Insert_fotoView view = new Insert_fotoView();
/*----#start-code(index)----*/
model.loadSeparatorlist_1(Core.query("teste_isac_pg_1","SELECT nome as nome, pai as nome_de_pai, mae as nome_da_mae, idade as idade FROM public.teste "));
/*----#end-code----*/
view.setModel(model);
return this.renderView(view);
}
/*----#start-code(custom_actions)----*/
/*----#end-code----*/
}

and voilá [Fig. 2]... it's show the data is stored in test database[Fig. 3]

[Fig. 2] Separator List
[Fig. 3] Database
Contents
JavaSQL