dcsimg
Jsp and data base connectivity.... compiler errors.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   somu_rajan
Posted On:   Thursday, August 28, 2003 01:35 AM

i want to load the combo box values dynamically from the data base. For this i wrote a function name "connectdb" in the bean. in the bean i have used the getProperty method to return the result set i.e) public void getResult() { return restultset}. IN the jsp page i called the connect method first and then the getproperty to return the result set. the code which i used in my jsp page is as follows. ---------------------------------------------- <%@ page import="java.sql.*" %> <% connectsqlserver.connectdb(); %> <% ResultSet rs; %> <% rs= %> <% while (rs.next()) { %> <% String val = %> <%= rs.getString(1) %> <%    More>>

i want to load the combo box values dynamically from the data base.
For this i wrote a function name "connectdb" in the bean. in the bean i have used the getProperty method to return the result set i.e) public void getResult() { return restultset}.
IN the jsp page i called the connect method first and then the getproperty to return the result set.
the code which i used in my jsp page is as follows.
----------------------------------------------
<%@ page import="java.sql.*" %>

<% connectsqlserver.connectdb(); %>
<% ResultSet rs; %> <% rs= %>
<% while (rs.next()) { %>
<% String val = %> <%= rs.getString(1) %>
<% String.valueOf(val); %> <% } %>

--------------------------------------

1. when i tried to view the page it gives the following errors.
incompatible types :

in line numbers 16 * 18.

line number 16 is the <% connectsqlserver.connectdb(); %>

2. is it a good method to return the result set from the bean class?

is there any other method to connect the data base?

could any body can help me in this regard.

   <<Less
About | Sitemap | Contact