| | |
jsp exception
Please support our JSP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2008
Posts: 9
Reputation:
Solved Threads: 0
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,
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,
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?
Did you stored data retrieved from database in this bean?
Can you post the section of code for DB data retrieval?
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
•
•
Join Date: Jul 2008
Posts: 9
Reputation:
Solved Threads: 0
Hi this is the databse related code
Java Syntax (Toggle Plain Text)
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; } }
Last edited by peter_budo; Aug 28th, 2008 at 5:50 am. Reason: Keep It Organized - please use [code] tags
I think in
you actually wanted to say
as it is where all DB results going
JSP Syntax (Toggle Plain Text)
request.setAttribute("array",categoryList);
request.setAttribute("array",categoryArray);while (resultSet.next()) {
productsearchDBVO=new ProductSearchDBVO();
productsearchDBVO.setProductCategory(resultSet.getString(1));
categoryArray.add(productsearchDBVO);
} Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
![]() |
Similar Threads
- connecting jsp with mysql database (JSP)
- URGENT: JSP - StackOverFlow Error (JSP)
- need HELP .jpf/weblogic/jsp - with CODE (JSP)
- tomcat5.0 server encountering a internal error while using jsp (JSP)
- Problem connecting my Tomcat Server and MySQL using JSP (JSP)
- Array String not working? (JSP)
- [urgent] JSP problem (JSP)
- Multithreading in jsp-HELP!!! (JSP)
- connecting to mssql with using jsp (JSP)
Other Threads in the JSP Forum
- Previous Thread: Jsp page to insert data
- Next Thread: Beginner in JSP
| Thread Tools | Search this Thread |
apache backbutton combobox connection database development directorystructure dynamicpagetitles eclipse frames glassfish imagetodatabse imageupload internet java javaee javascript jsf jsp jsppagetitles levels mvc2 mvcmodel2 network parameters passing ping printinserverinsteadofclient redirect request.getparameter response servlet servletdopost()readxml sessions software ssl state_saving_method stocks sun tomcat tutorial video web






