You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 131 Next »

Good day

Do you have any example about how to populate a selectbox from a postgres database?

I've trying this code, but it is not working.

import org.joget.apps.form.model.*;
import org.joget.apps.form.service.*;
import java.sql.*;
import org.apache.commons.collections.SequencedHashMap;
import java.util.*;

Class.forName("org.postgresql.Driver");
Connection connection = null;
connection = DriverManager.getConnection(
   "jdbc:postgresql://localhost:5432/jwdb","user", "pwd");
connection.close();

if(!connection.isClosed()){
PreparedStatement stmt = connection.prepareStatement("select id_usuario, mviciv from a_umv_ejemplo");
ResultSet rs = stmt.executeQuery();
FormRowSet f = new FormRowSet();
f.setMultiRow(true);
while (rs.next())
Unknown macro:

Unknown macro: { FormRow vRow = new FormRow(); vRow.put(FormUtil.PROPERTY_VALUE, rs.getString(2)); vRow.put(FormUtil.PROPERTY_LABEL, rs.getString(1)); f.add(vRow);}

 f.add(vRow);
  }
return f;
 }

  • No labels