Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_jsp thread: Pls help me out Java guru's


Message #1 by "Preeti" <preetisikri@h...> on Thu, 22 Feb 2001 13:45:38 -0500
Hi there ..

I had gone through your problem.
In your JSP, you are using the following line.
/*facing problem here*/  disBean rs[] = disBean.query();
The line .. disBean.query() indicates that query() should be static method.
But this method is not static in your disBean class.
So, to get rid of this problem, instantiated using the following line.
disBean dis=new disBean();
Then replace your line with the following line.
disBean rs[] = dis.query();

Then your problem will be solved.
I am giving the corrected source code below.
<%@ page language="Java" import="java.sql.ResultSet" %>
<%@ page import="shop.disBean"%>
<HTML>
<HEAD>
<TITLE>
Display Products
</TITLE>
</HEAD>
<BODY topmargin="0" leftmargin="0">
<table cellspacing="2" cellpadding="2" border="1">
<tr>
List of Products
<table border="3">
<tr>
<td>Product Name</td>
<td>Price</td>
<td>Color</td>
<td>Brand</td>
<td>Category Name</td>
</tr>

<%
 disBean dis=new disBean();
 /*facing problem here*/  disBean rs[] = dis.query();
  if (rs!=null)
  {
      int i = rs.length;
      for (int j = 0; j < i;j++)
      {
%>
<tr>
<td><%= rs[j].getProduct_name()%></a></td>
<td><%= rs[j].getPrice()%></td>
<td><%= rs[j].getColor() %></td>
<td><%= rs[j].getBrand() %></td>
<td><%= rs[j].getCategory_name() %></td>
</tr>
<%
      }
  }
%>
</table>
</td></tr></table>
</BODY>
</HTML>

Hope I am clear on your problem..

with rgds,
M.V.Rao
Wipro Technologies
Survey No 64, Madhapur
Hyderabad - 500 033 , India.
Tel(w): +xx-xx-xxx xxxx(direct), Board +xx-xx-xxx xxxx
Tel(h): +xx-xx-xxx xxxx
E-mail:venkat.rao@w...
Corporate Web Site : www.wipro.com
The World's First SEI CMM Level 5 Software Services Company

  Return to Index