I have a jsp page in which i have few parameters for the user to select and on clicking submite
it shud display the data on the same jsp page from the servlet to which it goes
so these are the lines i used to go back to the jsp page
Servlet
-----------------
DBUtilLogin dbTrade= new DBUtilLogin();
List TradeDet=dbTrade.getTradesDate(paramMap);
request.setAttribute("TradeDet", TradeDet);
request.getRequestDispatcher("mainjsp.jsp").forwar d(request, response);
DBUtilLogin.java
---------------------
public List getTradesDate(Map<String, String> paramMap){
ResultSet rstd=null;
Statement sttraded=null;
if (con==null) init();
try{
String inves=paramMap.get("inves");
String frmdt=paramMap.get("from_date");
String todt=paramMap.get("to_date");
System.out.println("the investor id is retrieved "+inves);
StringBuilder sqltd=new StringBuilder("select * from trades where investor ='"+inves+"' and to_date(trd_date,'YYYYMMDD')>= to_date('"+frmdt+"', 'DD/MM/YYYY') and to_date(trd_date,'YYYYMMDD')<= to_date('"+todt+"', 'DD/MM/YYYY')");
sttraded=con.createStatement();
rstd=sttraded.executeQuery(sqltd.toString());
List tradeListd=new ArrayList();
Map obj;
while(rstd.next()){
obj=new HashMap();
obj.put("TRD_DATE", rstd.getString(1));
obj.put("MRKT", rstd.getString(2));
obj.put("QTY", rstd.getString(7));
obj.put("SEC", rstd.getString(9));
tradeListd.add(obj);
}
return tradeListd;
}catch (SQLException ex) {
//Logger.getLogger(DBUtilLogin.class.getName()).log( Level.SEVERE, null, ex);
ex.printStackTrace();
return null;
}
}
mainjsp.jsp
---------------
The data displays here if i give this
<table>
<c:forEach var="TradeDet" items="${TradeDet}">
<tr>
<td>"${TradeDet}</td>
</tr>
</c:forEach>
</table>
But its in an ugly format and not table format.
"[{SEC=fff, QTY=1000, MRKT=0, TRD_DATE=20110209}, {SEC=ttt, QTY=40000, MRKT=0, TRD_DATE=20120209} ...and so on it goes like this
i want it to display in a proper table format.
How do i display each row with proper data?
SEC QTY MRKT TRD_DATE
fff 1000 0 20110209
ttt 4000 0 20110209
PLease help!!