Hello guys, I am converting my servlet page into mvc form and struck at perticular point.
I am using DAO class and VO class for database related tasks.Here I am sending u a little bit of my code segments so taht u can understand my problem.
In DAO class:-
//I havent write whole things only main things require for //understanding I am writing here
StdprdDAO.java
Public arrayList getPFP()
{
ArrayList a = new ArrayList();
While(rs.next())
{
columnsVO colVO = new columnsVO;
colVO.setProduct(rset.getString(1));//will store in String colProduct
colVO.setFamily(rset.getString(2));//will store in String colFamily
colVO.setPrice(rset.getString(3));//will store in String colPrice
a.add(colVO);
}
return a;
}
In Action Class:-
ArrayList final = null;
StdprdDAO DAO = new stdprdDAO();
final = DAO.getPFP();
For(int i = 0; final !=null && i<final.size() ; i++)
{
columnsVO VO = null;
VO = (columnsVO)final.get(i);
String p1 = (String) VO.getProduct();
String p2 = (String) VO.getFamily();
String p3 = (String) VO.getPrice();
Request.setAttribute(“p1”,p1);
Request.setAttribute(“p2”,p2);
Request.setAttribute(“p3”,p3);
}
In JSP PAGE:-
<logic:iterate id = “columnsVO”>
<bean:write name = “columnsVO” property=”final” id=”p1”>
but still I am doubting my above sentences in jsp page ,so pls correct them if possible.
1.Instead of logic:iterate can I use directly getattribute(“p1”)?
2.Still I m doubting I can not utilize columnsVO file in logic:iterate, I can utilize only formbean file.
3.So pls help me with this.