-
JSP (
http://www.daniweb.com/forums/forum24.html)
- -
jsp exception (
http://www.daniweb.com/forums/thread142732.html)
| sangham | Aug 28th, 2008 4:07 am | |
| jsp exception Hi friends,
I am using struts framework. I problem is I have fetched the data from from the databse in arraylist and want to display in the drop down here is the code i have written
<html:select property="productCategory">
<html:options collection="array" />
</html:select>
But I am getting following exception:
javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean under name array
I have this line in my action class:
request.setAttribute("array",categoryList);
Please tell me where am i going wrong
Thanks, |
| peter_budo | Aug 28th, 2008 5:03 am | |
| Re: jsp exception As message says "Cannot find bean under name array".
Did you stored data retrieved from database in this bean?
Can you post the section of code for DB data retrieval? |
| sangham | Aug 28th, 2008 5:19 am | |
| Re: jsp exception Hi this is the databse related code
public class ProductSearchDAOOracleImpl extends OracleDAOImpl implements ProductSearchDAO {
private String QUERY_GETCATEGORY = "SELECT * FROM Category";
//ProductSearchForm productsearchform=(ProductSearchForm) form;
private ArrayList categoryArray= new ArrayList() ;
@Override
public ProductSearchDBVO getCategory()
throws DatabaseException {
ProductSearchDBVO productsearchDBVO = null;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet resultSet = null;
try {
conn = getConnection();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw new DatabaseException(e);
}
try {
pstmt = conn.prepareStatement(QUERY_GETCATEGORY);
resultSet = pstmt.executeQuery();
while (resultSet.next()) {
productsearchDBVO=new ProductSearchDBVO();
productsearchDBVO.setProductCategory(resultSet.getString(1));
categoryArray.add(productsearchDBVO);
}
}catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw new DatabaseException(e);
}finally {
// Close all the resources properly.
closeResources(resultSet, pstmt, conn);
}
return productsearchDBVO;
}
} |
| peter_budo | Aug 28th, 2008 5:54 am | |
| Re: jsp exception I think in
request.setAttribute("array",categoryList);you actually wanted to say
request.setAttribute("array",categoryArray);as it is where all DB results going
while (resultSet.next()) {
productsearchDBVO=new ProductSearchDBVO();
productsearchDBVO.setProductCategory(resultSet.getString(1));
categoryArray.add(productsearchDBVO);
} |
| All times are GMT -4. The time now is 8:35 pm. | |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC