I have a java class where i have a method and that method is taking some parameter like
below is my java code which has a getoutlet method
public List<String> getoutlet(String idDB) throws ClassNotFoundException, SQLException {
List<String> list = new ArrayList<String>();
con = DBConnection.createConnection();
statement = con.createStatement();
String sqlOutlet="select CUSTOMERDESCRIPTOR from ecustomer where CUSTOMERIDENTIFIER in(select CUSTOMERIDENTIFIER from mt_distributrol where mt_distributr_vcdistributrcode = '"+idDB+"')";
try {
ResultSet resultSet = statement.executeQuery(sqlOutlet);
while (resultSet.next()) {
list.add(resultSet.getString("CUSTOMERDESCRIPTOR"));
}
} catch (SQLException e) {
e.printStackTrace();
}
return list;
}
if i put system.out.print it gives me the list [jayanagar,malleshwaram,kolar,ol1]
but it is throwing an error while called from the UI (jsp) using c:for:each
i am passing idDB as a parameter now in a list i am getting like this
[jayanagar,malleshwaram,kolar,ol1]
now i am calling this method by c:for:each in my jsp to populate this in a select option but the problem is it is throwing error
like my c:for:each code is
<jsp:useBean id="obj" class="com.touchpoint.Dao.Outlet" scope="page" />
<select id="all" name="outlet">
<option>ALL</option>
<c:forEach var="item" items="${obj.outlet}">
<option>${item}</option>
</c:forEach>
</select>
if iam not passing any parameter to my getoutlet method then its working fine but now i have to pass some parameter as per requirnment,The error it is showing is '${obj.outlet}' Property 'outlet' not found on type com.touchpoint.Dao.Outlet Outlet is my java class name so anyone out there please help me out
this is my java class
public class Outlet {
Connection con = null;
Statement statement = null;
ResultSet resultSet = null;
public List<String> getoutlet(String idDB) throws ClassNotFoundException, SQLException {
List<String> list = new ArrayList<String>();
con = DBConnection.createConnection();
statement = con.createStatement();
// String sqlOutlet="select CUSTOMERDESCRIPTOR from ecustomer where CUSTOMERIDENTIFIER in(select CUSTOMERIDENTIFIER from mt_distributrol where mt_distributr_vcdistributrcode = '"+idDB+"')";
String sqlOutlet="select * from ecustomer')";
/*System.out.println(idDB);*/
try {
ResultSet resultSet = statement.executeQuery(sqlOutlet);
while (resultSet.next()) {
list.add(resultSet.getString("CUSTOMERDESCRIPTOR"));
}
} catch (SQLException e) {
e.printStackTrace();
}
return list;
}
}
it is returning me [jayanagar,malleshwaram,kolar] now i want to show this list in my select option dropdown