Hi All

I have tried to rewrite the Beans as suggested by Vivek. That is connection
is established in the constructor.

Please see my Bean and the corresponding JSP. Still it is giving problem.
Problem is in the bold letter within the JSP page as below.
In the JSP page...( for full jsp page see below)

dbConnect.setResultset(query1);
ResultSet rs=dbConnect.getResultset();

( when I am writting the above two the error is as follows :
*** Error: "dbConnect" is either a misplaced package name or a non-existent
entity.)

OR

dbAccess.jspDbAccess.setResultset(query1);
ResultSet rs=dbAccess.jspDbAccess.getResultset();

Please see the code and suggest. Plzzzzzzzzzzzzzz.

Thanks & Regards
Pradeep

Beans:

package dbAccess;

import java.util.*;
import java.sql.*;
import java.lang.*;
import java.io.*;

public class jspDbAccess {

        String firmcode;
        String workid;
        String job;
        String costcode;
        Statement statement=null;
                Connection connection=null;
        ResultSet resultSet=null;

//Constructor

        public jspDbAccess()
         {
         String driverName="com.ibm.as400.access.AS400JDBCDriver";
         String url="jdbc:as400://xxxx" ;
         String user="xxxx";
         String passwd="xxxxx";

         try
         {
         //loading the driver
             Class.forName(driverName);
             connection = DriverManager.getConnection(url, user, passwd);
             statement=connection.createStatement();
          System.out.println("connected");
         }
         // Error if fail to load the driver
         catch (Exception exp)
         {
             connection=null;
             System.out.println("Error occured at loading the Driver: "
+exp);
         }

         }


//
        public void setResultset(String sqlStr)
        {

        try
         {
             resultSet=statement.executeQuery(sqlStr);
         }
         catch (Exception exp)
         {
             System.out.println("Error occured at loading the Driver: "
+exp);
         }

         }

//
        public ResultSet getResultset()
        {
                return resultSet;
        }


//
        public void setFirmcode(String firm)
        {
                if (firm != null )
                {
                firmcode=firm;
                }
        }

//
        public void setWorkid(String id)
        {
                if (id != null )
                {
                workid=id;
                }
        }

//
        public void setJob(String Jobname)
        {
                if (Jobname != null )
                {
                job=Jobname;
                }
        }

//
        public void setCostcode(String code)
        {
                if (code != null )
                {
                costcode=code;
                }
        }

//
        public void reset()
        {

        }
}

And the JSP is as follows:


<%@ page import="java.sql.*,java.io.*, java.lang.*, javax.servlet.
*,javax.servlet.http.*" %>

<jsp:useBean id="dbConnect" class="dbAccess.jspDbAccess" scope="session">
<jsp:setProperty name="dbConnect" property="*" />
</jsp:useBean>

<html>
<head> <title>Puchase Order Enquiry</title> </head>
<body        text="White"
        bgcolor="#000000"
        leftmargin=0
        topmargin=0
        marginwidth=0
        marginheight=0>

<hr align="left" width=19% size=2 color="White">

<table width="175" border="0" cellspacing="0" cellpadding="0">

 <tr>
        <td valign="TOP">
        <img align="middle" src="jpLogo_3.gif" width=149 height=75
border=0
        alt="Jobpac Logo"></td>
 </tr>

</table>

<hr align="left" width=19% size=2 color="White">

<img align="middle" src="poEnquiry.gif" width=780 height=16 border=0 alt
="Jobpac Logo">

<% if         ((request.getParameter( "Workid" ) != null) &&
         (request.getParameter( "Job" ) != null) &&
         (request.getParameter( "Costcode" ) != null) &&
         (request.getParameter( "Resultset" ) != null)) { %>

<%
        String firm = request.getParameter( "Workid" );
        String jobname = request.getParameter( "Job" );
        String cstcode = request.getParameter( "Costcode" );

        String costcodeName="";
        String jobDescript="";

String query1="SELECT OIORDN, OIITEM, OIDESC, OIQORD, OIUNIT, OIGUPR2,
OITVAL from jp521dtai.jpordoi1 WHERE OIFMCD = '" + firm + "' AND OIJOB = '"
+ jobname + "' AND OICODE = '" + cstcode + "'" ;

String query2="SELECT DESCRIPT from jp521dtai.jobs WHERE OIFMCD = '" + firm
+ "' AND OIJOB = '" + jobname + "'" ;

%>


<%

dbConnect.setResultset(query1);
ResultSet rs=dbConnect.getResultset();

( when I am writting the above two the error is as follows :
*** Error: "dbConnect" is either a misplaced package name or a non-existent
entity.)

OR

dbAccess.jspDbAccess.setResultset(query1);
ResultSet rs=dbAccess.jspDbAccess.getResultset();

( when I am writting the above the error is as follows :

*** Error: The method "setResultset" does not denote a class method

try
        {
        int size=rs.getFetchSize();
        }
catch (Exception exp)
          {
         out.println("what is the error");
        }
%>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to