UseBean error?

i tried to do a simple database connectivity program in jsp.
SqlBean.java program defines the connections
import java.sql.*;
import java.io.*;
public abstract class SqlBean
private String driverName = "com.mysql.jdbc.Driver";
String serverName = "192.168.10.5";
String mydatabase = "Trainees";
String url = "jdbc:mysql://" + serverName +  "/" + mydatabase;
String username = "venkat";
String password = "venkat";
protected Connection con;
public SqlBean()
public void makeConnection() throws Exception
     Class.forName(driverName);
     con = DriverManager.getConnection(url, username, password);     
public abstract void cleanup() throws Exception;
public void takeDownm() throws Exception
     cleanup();
     con.close();
}EmpQBean.java provides the queries
import java.sql.*;
import java.io.*;
public class EmpQBean extends SqlBean
String myEmpSQL = "select * from employee";
ResultSet rset = null;
Statement stmt = null;
public EmpQBean()
     super();
public boolean getNextEmployee() throws Exception
     return rset.next();
public String getColumn(String inCol)throws Exception
     return rset.getString(inCol);
public boolean getEmployees() throws Exception
     String myQuery = myEmpSQL;
     stmt = con.createStatement();
     rset = stmt.executeQuery(myQuery);
     return (rset != null);
public void cleanup() throws Exception
     stmt.close();
}dbQuery.jsp page calls the java programs.
<html>
<head>
</head>
<% page language="java" import="java.sql.*" %>
<jsp:useBean id="empbean" class="EmpQBean" scope="page" />
<body>
<table border="1" width="400">
<tr>
<td>ID</td>
<td>Last Name</td>
<td>First Name</td>
<td>Extensions</td>
</tr>
<%
empbean.makeConnection();
if(empbean.getEmployees())
while(empbean.getNextEmployee())
String eid = empbean.getColumn("empid");
String last = empbean.getColumn("lastname");
String first = empbean.getColumn("firstname");
String ext = empbean.getColumn("extension");
%>
<tr>
<td><%=eid%></td>
<td><%=last%></td>
<td><%=first%></td>
<td><%=ext%></td>
</tr>
<%
empbean.takeDown();
%>
</table>
</body>
</html>when i run the jsp page, am getting an error:
org.apache.jasper.JasperException: /databases/dbQuery.jsp(5,0) The value for the useBean class attribute EmpQBean is invalid.
     org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
     org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
     org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
     org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1223)
     org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
     org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
     org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
     org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
     org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
     org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
     org.apache.jasper.compiler.Generator.generate(Generator.java:3284)
     org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:189)
     org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
     org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
     org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
     org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Is there anything wrong in this code? can anyone please help..

Then declare it to be so.
package database;
import ........
class .......

Similar Messages

  • jsp:useBean error== The value for useBean class is invalid

    Can anybody tell me why am i getting the error for the JavaBean.
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: /SimpleBean.jsp(9,0) The value for the useBean class attribute com.stardeveloper.bean.test.SimpleBean is invalid.
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
         org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1272)
         org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1178)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
         org.apache.jasper.compiler.Generator.generate(Generator.java:3426)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:216)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.20 logs.
    Apache Tomcat/6.0.20
    my jsp file is in path c:\tomcat6\webapps\dev\SimpleBean.jsp
    my JavaBean compiled class is in path
    c:\tomcat6\webapps\dev\WEB-INF\classes\com\stardeveloper\bean\test\SimpleBean.class
    and my SimpleBean java class declaration is
    package com.stardeveloper.bean.test;
    public class SimpleBean implements java.io.Serializable
    and my jsp page SimpleBean.jsp pages call to useBean is as follows
    <jsp:useBean id="simple" class="com.stardeveloper.bean.test.SimpleBean">
         <jsp:setProperty name="simple" property="name" value="Sujoy" />
         <jsp:setProperty name="simple" property="age" value="26" />
    </jsp:useBean>
    Please help me anybody.

    First, try restarting Tomcat :-)
    Main 3 reasons for "useBean class is invalid"
    - class must be in a package (ok)
    - class must be public, and have public constructor that takes no arguments (check)
    - class must be compiled, valid and on the classpath. Normally this means the WEB-INF/classes directory.
    From what you have told us, everything seems to check out.
    Try recompiling the .class file to ensure it is valid.
    Does your constructor do anything which might thrown an exception?
    Can you invoke it in scriptlet code without getting an exception?
    <%@ page import="com.stardeveloper.bean.test.SimpleBean" %>
    <% SimpleBean sb = new SimpleBean() %>Trying it in scriptlet code like this might give you a different error message that might help your diagnosis.
    cheers,
    evnafets

  • Jsp:useBean error.

    Under webapps\CustSys\web-inf\classes, I have save my CIS.class file. Is this the rite way to access the java class file : doReport() is a function inside the class file.
    Inside test2.jsp:
    <jsp:useBean id="report" scope="application" class="CIS"/>
    <html>
    <%report.doReport();%>
    </html>
    the following error appear:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 0 in the jsp file: /test2.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    C:\Tomcat4129\work\Standalone\localhost\CustSys\test2_jsp.java:41: cannot resolve symbol
    symbol : class CIS
    location: class org.apache.jsp.test2_jsp
    CIS report = null;
    ^
    An error occurred at line: 0 in the jsp file: /test2.jsp
    Generated servlet error:
    C:\Tomcat4129\work\Standalone\localhost\CustSys\test2_jsp.java:43: cannot resolve symbol
    symbol : class CIS
    location: class org.apache.jsp.test2_jsp
    report = (CIS) pageContext.getAttribute("report", PageContext.APPLICATION_SCOPE);
    ^
    An error occurred at line: 0 in the jsp file: /test2.jsp
    Generated servlet error:
    C:\Tomcat4129\work\Standalone\localhost\CustSys\test2_jsp.java:46: cannot resolve symbol
    symbol : class CIS
    location: class org.apache.jsp.test2_jsp
    report = (CIS) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "CIS");
    ^
    3 errors
         at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:130)
         at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
         at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:353)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
         at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
         at java.lang.Thread.run(Thread.java:534)
    pls help identify wat's the error. thanks

    You will have to put the CIS class in a package and provide the fully qualified class name pkg.CIS in your useBean defintion
    cheers,
    ram.

  • An error in jsp page useBean when i try to include the java bean package?

    Hi Sir,
    I am using import com.project.ShowData in java beans inorder to connect to the jsp.
    The jsp code goes like this:-
    <%@ page import="com.project.ShowData" %>
    <jsp:useBean id="jspuser1" class="com.viman.ShowData" scope="session"/>
    <jsp:setProperty name="jspuser1" property="*"/>
    Here the error is showing as cannot resolve symbols in com.project.ShowData.But i have given the same in java beans like this:-
    Package com.project;
    //import of package goes here
    public class ShowData
    //code goes here
    It seems that all are correct here.I have done few programs using this without any problem.But suddenly it is giving a problem like this.What is the problem here?It is quite Urgent.Thank u.
    Regards,
    m.ananthu

    Greetings,
    Here the error is showing as cannot resolve symbols in com.project.ShowData.But i have given the
    same in java beans like this:-Seeing the actual error would be more helpful. ;)
    Regards,
    m.ananthu Regards,
    Tony "Vee Schade" Cook

  • Jsp:useBean giving error while compiling JSP's in JDeveloper

    Hello,
    I am having another problem with JSP's in JDeveloper 10.1.3. jsp:useBean and jsp:setProperty are all giving problems. I am not sure what I need to do to get rid of this error
    Thanks,
    Lakshmisri

    Your original post mentions issues with jsp:useBean and jsp:setProperty, now you're talking about tag libraries and directives. Can you be more specific about what you're trying to do? Are you having problems getting JDev to recognize a tag library or are you having problems with the tag library when running the app? What directive are you trying to use that causes the termination error?

  • 9.0.3 Preview - Class not found error after including jsp:useBean

    Hi,
    I got a Java.lang.NoClassDefFoundError while compiling a JSP Page, after including a simple web bean as follows:
    <jsp:useBean id="catviews" scope="request" class="CategoryView" />
    <jsp:setProperty name="catviews" property="*" />
    somewhere within the HTML page...
    <%= catviews.getCategory() %>
    The JSP page without the bean compiles fine and the Javabean itself compiles without error. The bean class is where JDev automatically puts it (i.e in a sub-directory of the classes directory within the project) and JDev does not raise any error on that JSP Page before compiling.
    The error seems to point to the first line of the page, to the directive of the JSP page:
    <%@ contentType="text/html" ... %> which is apparently harmless. What can be wrong ?
    Thanks for your reply.

    'Class not found' means 'Class not found' , the class you are referencing is not in your project's classpath. You should make sure your project's classpath point to the location where this class is deployed to. This could be a directory or a .jar file. You should also include the package name as part fo the class.

  • " ')' expected " Error when compile jsp that use useBean tag

    I'm using JDeveloper 10.1.3 and I have a page with a next jsp tag
    <jsp:useBean id="objectid" type="package.MyClass" scope="application"/>
    When I compile this JSP page, I got the error:
    ')' expected
    If the application is deployed in the J2EE container like Tomcat or OC4J, the page works fine.
    Is this a JDeveloper bug?? What Can I do?

    The JSP page works fine in OC4J 10.1.2, but in the OC4J 10.1.3 it throws the same error.
    The soruce code that the container generates is this:
    if ((objectid= (package.MyClass) pageContext.getAttribute( "objectid", PageContext.APPLICATION_SCOPE)) == null) {
    throw new InstantiationException("No se ha encontrado el bean "objectid" en el ámbito "application"");
    The bug consist in the generation of the servlet source code. The double quotation is the problem, for that, the compiler generates the error ')' expected...

  • Error trying to use jsp:useBean

              I am trying to use a class in a JSP that is basically a connection to an
              Oracle database. It works fine when used from a servlet. However, when I try
              to instantiate it from a JPS page, I get errors. Here is the snippet from
              the JSP page:
              <%@ page import="engr.projmgmt.*" %>
              <jsp:useBean id="OB" class="engr.projmgmt.OracleBroker" />
              The class is here:
              /usr/local/apache/servlets/engr/projmgmt/OracleBroker.class
              The weblogic class path contains /usr/local/apache/servlets.
              I get the following error in the weblogic log:
              Mon Aug 13 17:39:15 PDT 2001:<E> <ServletContext-General> Servlet failed
              with Exception
              java.lang.ClassNotFoundException: class engr.projmgmt.OracleBroker :
              java.lang.IllegalAccessException: engr/projmgmt/OracleBroker
              at java.beans.Beans.instantiate(Beans.java:215)
              at java.beans.Beans.instantiate(Beans.java:55)
              at jsp_servlet._PM._index._jspService(_index.java:90)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              :120)
              at
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
              l.java:915)
              at
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
              l.java:879)
              at
              weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
              Manager.java:269)
              at
              weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:365)
              at
              weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:253)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129)
              --------------- nested within: ------------------
              weblogic.utils.NestedRuntimeException: cannot instantiate
              'engr.projmgmt.OracleBroker' - with nested exception:
              [java.lang.ClassNotFoundException: class engr.projmgmt.OracleBroker :
              java.lang.IllegalAccessException: engr/projmgmt/OracleBroker]
              at jsp_servlet._PM._index._jspService(_index.java:92)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              :120)
              at
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
              l.java:915)
              at
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
              l.java:879)
              at
              weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
              Manager.java:269)
              at
              weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:365)
              at
              weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:253)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129)
              Anyone have anyideas?
              Thanks,
              CC
              

    I appears that your default constructor is not publicly accessible from the
              exception.
              Sam
              "Chuck Carson" <[email protected]> wrote in message
              news:[email protected]...
              >
              > I am trying to use a class in a JSP that is basically a connection to an
              > Oracle database. It works fine when used from a servlet. However, when I
              try
              > to instantiate it from a JPS page, I get errors. Here is the snippet from
              > the JSP page:
              >
              > <%@ page import="engr.projmgmt.*" %>
              > <jsp:useBean id="OB" class="engr.projmgmt.OracleBroker" />
              >
              > The class is here:
              > /usr/local/apache/servlets/engr/projmgmt/OracleBroker.class
              > The weblogic class path contains /usr/local/apache/servlets.
              >
              > I get the following error in the weblogic log:
              >
              > Mon Aug 13 17:39:15 PDT 2001:<E> <ServletContext-General> Servlet failed
              > with Exception
              > java.lang.ClassNotFoundException: class engr.projmgmt.OracleBroker :
              > java.lang.IllegalAccessException: engr/projmgmt/OracleBroker
              > at java.beans.Beans.instantiate(Beans.java:215)
              > at java.beans.Beans.instantiate(Beans.java:55)
              > at jsp_servlet._PM._index._jspService(_index.java:90)
              > at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              > at
              >
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              > :120)
              > at
              >
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
              > l.java:915)
              > at
              >
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
              > l.java:879)
              > at
              >
              weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
              > Manager.java:269)
              > at
              >
              weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:365)
              > at
              > weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:253)
              > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129)
              > --------------- nested within: ------------------
              > weblogic.utils.NestedRuntimeException: cannot instantiate
              > 'engr.projmgmt.OracleBroker' - with nested exception:
              > [java.lang.ClassNotFoundException: class engr.projmgmt.OracleBroker :
              > java.lang.IllegalAccessException: engr/projmgmt/OracleBroker]
              > at jsp_servlet._PM._index._jspService(_index.java:92)
              > at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              > at
              >
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              > :120)
              > at
              >
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
              > l.java:915)
              > at
              >
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
              > l.java:879)
              > at
              >
              weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
              > Manager.java:269)
              > at
              >
              weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:365)
              > at
              > weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:253)
              > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129)
              >
              >
              > Anyone have anyideas?
              >
              > Thanks,
              > CC
              >
              >
              

  • UseBean tag gives error please help

    Hi,
    I keep getting an error in my browser regarding the java.util.Collection class I am including in my jsp page.
    <%@ page import="java.util.*, src.com.database.*, src.com.data.*, src.com.business.*" %>
    <jsp:useBean id="persons" scope="request" class="java.util.Collection" />I see the following error:
    The value for the useBean class attribute java.util.Collection is invalid
    The collection is not empty because back on the server I loop over the collectiion and see a lot of data.
    When I import a String class like this it works fine:
    <jsp:useBean id="errorMsg" scope="request" class="java.lang.String" />I use tomcat 6.0.10 and java 1.6.0
    Thanks for any help,
    Jarno

    You can use only bean, not a class.A bean is actually a class ;)
    The point is that the declared class should have at least an no-arg constructor and thus is instantiable (e.g. SomeObject someObject = new SomeObject(); must be possible). An interface doesn't confirm this requirement as you simply cannot instantiate interfaces.

  • Urgent help please : useBean: Duplicate bean name error

    hi,
    i am trying to add a record to data base and my bean name is
    DBConn. when i try instantiate it is giving error. help imm.
    code:
    <%@ page import="java.sql.*" %>
    <jsp:useBean id="DConn" scope="request" class="src.DBConn" />
    <%
         try {
         ResultSet rsa;
         String sclName = request.getParameter("SclName");
         String sclMissing = request.getParameter("SclMissing");
         int intMeasure= Integer.parseInt(request.getParameter("SclMeasure"));
         String sclMeasure = "";     
         boolean     flag=false;
         switch(intMeasure) {
         case 0:     
              sclMeasure="O";
              break;
         case 1:
              sclMeasure="M";     
              break;
         case 2:
              sclMeasure="N";
              break;
         String RecValue[]= new String [3];
         RecValue[0]=sclName;
         RecValue[1]=sclMeasure;
         RecValue[2]=sclMissing;
         flag=DConn.Execute("SCAMI1", new String[] { RecValue[0], RecValue[1],RecValue[2]});
         if (flag) {
         catch(Exception e) {
              System.out.println(e);
    %>

    i am mention the same bean in this page and after this, when i press the add button, i will move for another html page and from that page it will go to the bean which is given error.
    Code: Page1:
    =============
    <html><head><title>JSP Page</title>
    <%@ page language="java" import="java.sql.*" session ="true" %>
    <script type="text/javascript" >
         function AddSubmit()
         document.OutCome.action = "OutAddScale.html";
         document.OutCome.submit();
         function openModHtml()
              window.open ("OutModScale.html");          
         function openDelHtml()
              window.open ("OutDelScale.html");          
         function getRecord(thecaller) {
              (thecaller.value);
    </script>
    </head>
    <body>
    <FORM name=OutCome method="GET" >
    <P align=center><STRONG><FONT color=#000000>Out Come</FONT></STRONG> </P>
    <INPUT id=btnAdd name=btnAdd type=button value=Add onclick ="AddSubmit()" style="HEIGHT: 24px; WIDTH: 65px">
    <INPUT id=btnMod name=btnMod type=submit value=Modify style="LEFT: 136px; TOP: 381px" > 
    <STRONG><FONT color=#000000> </FONT></STRONG>
    <INPUT id=btnDelete name=btnDelete onclick ="openDelHtml()" type=button value=Delete style="LEFT: 190px; TOP: 381px">
    <p></p>
    <!-- data base connection. ->
    <jsp:useBean id="DConn" scope="page" class="src.DBConn" />
    <%
         DConn.DBConnect("MSSql","sun.jdbc.odbc.JdbcOdbcDriver","jdbc:odbc:ews","sa","sakshi123");
         response.setContentType("text/html");
         ResultSet rsa;
         String PSId="";
         String CSId="";
         try {
    %>
         <Table border="1" width=400>
         <tr>
         <td><b>Select</b></td>
         <td><b>Scale</b></td>
              <td><b>Measure</b></td>
              <td><b>Missing</b></td>
              <td><b>Options</b></td>
         </tr>     
    <%
              rsa=DConn.getRs("SCAMS1",new String[]{""});
              while(rsa.next()) {
                   CSId=     rsa.getString("ScaleId");
                   String id= rsa.getString("ScaleId");
                   String name= rsa.getString("ScaleName");
                   String measure= rsa.getString("Measure");
                   int missing = rsa.getInt("Missing");
                   String label= rsa.getString("Label");
                   int sclIndex = rsa.getInt("ScaleIndex");
                   if (measure.equals("O")) {
                        measure="Ordinal";
                   }else if ( measure.equals("M") ) {
                        measure="Metric";
                   }else if ( measure.equals("N") ) {
                        measure="Nominal";
                   if (!CSId.equals(PSId)) {
                        PSId=CSId;
    %>
                   <tr >
                        <Td><Input Type="Radio" name ="RSel" id="RSel" value= <%= CSId %> onClick="return getRecord(this )" ></td>
                        <td> <%= name %></td>
                        <td> <%= measure %></td>          
                        <td> <%= missing %></td>
                        <td> <%= sclIndex %> - <%= label %></td>
                   </tr>
    <%                         
                   }else {
    %>     
                   <tr>
                        <td></td>
                        <td></td><td></td><td></td>
                        <td><%= sclIndex %> - <%= label %></td>
                   </tr>
    <%
                   }     // else condition close          
         }     // while loop
    %>
         </table>
    <%
         }catch(Exception e){
              System.out.println(e);
              // e.printStackTrace();
    finally{      
    %> </form></body></html>
    code page2:
    ============
    <HTML><HEAD><TITLE>Add Scale</TITLE>
    <script language=javascript src="..\JScript\Validation.js">     
    </script>
    <script language=javascript src="..\JScript\Common.js">     
    </script>
    </HEAD>
    <body >
    <FORM name=AddScale method="GET" >
    <P align=center><STRONG>Add Scale</STRONG></P>
    <FONT color=darkblue>Scale Name 
    </FONT>   
    <INPUT id=SclName name=SclName onkeypress="return validateCharKeyPress(event)" style="WIDTH: 160px; HEIGHT: 18px"><P>
    <FONT color=darkblue>Scale Measure </FONT>
    <SELECT id=SclMeasure name=SclMeasure style="LEFT: 105px; WIDTH: 92px; TOP: 96px; HEIGHT: 22px">
                        <OPTION selected>ORDINAL</OPTION>
                        <OPTION>NOMINAL</OPTION>
                        <OPTION>METRIC</OPTION>
                        </SELECT></P>
    <p><FONT color=darkblue>Scale Missing</FONT>  
    <INPUT id=SclMissing name=SclMissing onkeypress="return validateNumberKeyPress(event)" style="LEFT: 98px; WIDTH: 155px; TOP: 101px; HEIGHT: 19px" align=right></p>
    <HR>
    <P><FONT color=darkblue><STRONG> Scale Options</STRONG></FONT></P>
    <SELECT id=SelScaleOpt name=SelScaleOpt onClick="SelList()" onChange="SelList()" size=2 style="WIDTH: 313px; HEIGHT: 114px" >
    <OPTION selected>1=Male</OPTION>
    <OPTION >2=FeMale</OPTION>
    </SELECT> 
    <p><FONT color=darkblue>                        
    <INPUT id=btnUp name=btnUp type=button value=UP onclick="LstUp()" style="WIDTH: 45px; HEIGHT: 24px" >
    <INPUT id=btnDown name=btnDown type=button value=Down onclick="LstDown()" style="LEFT: 67px; TOP: 436px" > </FONT></p>
    <p><FONT color=darkblue>Scale Option    </FONT>
    <INPUT id=txtScaleOpt name=txtScaleOpt onkeypress="return validateCharKeyPress(event)" style="WIDTH: 152px; HEIGHT: 20px"></p>
    <p>  
    <INPUT id=SclOptAdd name=SclOptAdd type=button value=Add onclick="addToList()" style="WIDTH: 65px; HEIGHT: 24px"> 
    <INPUT id=btnMod name=button1 style="LEFT: 136px; TOP: 381px" type=button value=Modify onclick="ModToList()" >
    <INPUT id=SclOptRemove name=SclOptRemove type=button value=Remove onClick="DelList()" style="LEFT: 190px; TOP: 381px"></p>
    <HR>
    <P>         
    <INPUT id=SclOk name=Ok type=button value=Save OnClick="ChkFields()" style ="WIDTH: 64px; HEIGHT: 24px">
    <INPUT id=SclCan name=Cancel style="WIDTH: 64px; HEIGHT: 24px" type=reset value=Cancel></P>
    </FORM>
    </body>
    </HTML>
    code page3 in this page its giving error
    ====================================================
    it is saying
    <jsp:useBean id="DConn" scope="page" class="src.DBConn" />
    <%     
         try {
         ResultSet rsa;
         String sclName = request.getParameter("SclName");
         String sclMissing = request.getParameter("SclMissing");
         String sclMeasure= request.getParameter("SclMeasure");
         if (sclMeasure.equals("ORDINAL")) {
              sclMeasure="O";
         }else if (sclMeasure.equals("METRIC")) {
              sclMeasure="M";     
         }else if (sclMeasure.equals("NOMINAL")) {
              sclMeasure="N";     
         String RecValue[]= new String [3];
         RecValue[0]=sclName;
         RecValue[1]=sclMeasure;
         RecValue[2]= sclMissing;          
    flag=DConn.Execute("SCAMI1", new String[]{RecValue[0],RecValue[1],RecValue[2]});
         if (flag) {
              out.println("tru");
         }else {
              out.write("false");
         catch(Exception e) {
              System.out.println(e);
    %>

  • Error jsp useBean  cant find class com.bloodoo.shoppingbasket

    I have an application which runs on my home Pc . It is a basic shopping cart app. I have Tomcat 4.1 and j2sdk1.4.2.
    When I transfered the application to Lunarpages my host , with the same folder structure I altered all the passwords and db connectors etc but when Itry to access the shop.jsp page I get the following error " useBean cant find class com.bloodoo.shoppingbasket " . I transferred the .java and .class files to Lunarpages.
    Do the .java files have to be compiled to .class files in the folder they wil be accessed ?
    If this is the case how are .java files compiled in a remote server?
    Any help very much appreciated .
    Thanks
    Jim Ascroft

    Hi there,
    I am using Tomcat on my home server and Lunarpages my web host uses Resin. I have not heard of resin and dont know if this would make any difference. All the folders and imports are ok on Tomcat at home and they are set up withy the same structure on Lunarpages.
    Any thoiughts ?
    Regards
    Jim Ascroft

  • Can't Create Bean Error

    I modified the numguess example that comes with tomcat but I get a "can't create bean" error message when I call my jsp file. If anyone can see what I'm doing wrong or suggest ways to discover the problem I'd appreciate it.
    My modified jsp:
    <!--
    Copyright (c) 1999 The Apache Software Foundation. All rights
    reserved.
    Number Guess Game
    Written by Jason Hunter, CTO, K&A Software
    http://www.servlets.com
    -->
    <%@ page import = "num.NumberGuessBean" %>
    <jsp:useBean id="numguess" class="num.NumberGuessBean" scope="session"/>
    <jsp:setProperty name="numguess" property="*"/>
    <html>
    <head><title>Number Guess</title></head>
    <body bgcolor="white">
    <font size=4>
    <% if (numguess.getSuccess()) { %>
    Congratulations! You got it.
    And after just <%= numguess.getNumGuesses() %> tries.<p>
    <% numguess.reset(); %>
    Care to try again?
    <% } else if (numguess.getNumGuesses() == 0) { %>
    Welcome to the Number Guess game.<p>
    Play with default limits ( a number between 0 and 100)<p>
    or enter upper and lower limits.<p>
    <form method=get>
    Play with defaults?: <input type=radio name=default value="yes">Yes
    <input type=radio name=default value="no">No
    <\form>
    <% if (numguess.getRadio().equals("no")) { %>
    <form method=get>
    Enter upper limit:<input type=text name=upperLimit>
    Enter lower limit:<input type=text name=lowerLimit>
    <\form>
    <% numguess.reset(); %>
    <% } %>
    <form method=get>
    What's your guess? <input type=text name=guess>
    <input type=submit value="Submit">
    </form>
    <% } else { %>
    Good guess, but nope. Try <b><%= numguess.getHint() %></b>.
    You have made <%= numguess.getNumGuesses() %> guesses.<p>
    I'm thinking of a number between <jsp:getProperty name="numguess" property="lowerLimit"/> and <jsp:getProperty name="numguess" property="upperLimit"/>.<p>
    <form method=get>
    What's your guess? <input type=text name=guess>
    <input type=submit value="Submit">
    </form>
    <% } %>
    </font>
    </body>
    </html>
    and the modified bean:
    * ====================================================================
    * The Apache Software License, Version 1.1
    * Copyright (c) 1999 The Apache Software Foundation. All rights
    * reserved.
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    * 1. Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    * 2. Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in
    * the documentation and/or other materials provided with the
    * distribution.
    * 3. The end-user documentation included with the redistribution, if
    * any, must include the following acknowlegement:
    * "This product includes software developed by the
    * Apache Software Foundation (http://www.apache.org/)."
    * Alternately, this acknowlegement may appear in the software itself,
    * if and wherever such third-party acknowlegements normally appear.
    * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
    * Foundation" must not be used to endorse or promote products derived
    * from this software without prior written permission. For written
    * permission, please contact [email protected].
    * 5. Products derived from this software may not be called "Apache"
    * nor may "Apache" appear in their names without prior written
    * permission of the Apache Group.
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
    * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    * SUCH DAMAGE.
    * ====================================================================
    * This software consists of voluntary contributions made by many
    * individuals on behalf of the Apache Software Foundation. For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    * Originally written by Jason Hunter, http://www.servlets.com.
    package num;
    import java.util.*;
    public class NumberGuessBean {
    int answer;
    boolean success;
    String hint;
    int numGuesses;
    String radiochoice;
    int lowerLimit=0;
    int upperLimit=100;
    String error;
    public NumberGuessBean() {
    reset();
    public void setGuess(String guess) {
    numGuesses++;
    int g;
    try {
    g = Integer.parseInt(guess);
    catch (NumberFormatException e) {
    g = -1;
    if (g == answer) {
    success = true;
    else if (g == -1) {
    hint = "a number next time";
    else if (g < answer) {
    hint = "higher";
    else if (g > answer) {
    hint = "lower";
    public void setRadio(String s) {
         radiochoice=s;
    public String getRadio() {
         return radiochoice;
    public void setLowerLimit( int lowerLimit) {
         this.lowerLimit=lowerLimit;
    public int getLowerLimit() {
         return lowerLimit;
    public void setUpperLimit(int upperLimit) {
         this.upperLimit=upperLimit;
    public int getUpperLimit() {
         return upperLimit;
    public boolean getSuccess() {
    return success;
    public String getHint() {
    return "" + hint;
    public String getError() {
         return ""+error;
    public int getNumGuesses() {
    return numGuesses;
    public void reset() {
         if (getRadio().equals("yes")) {
              answer = (int)(Math.random()*100);
         else {
              int i;
              i=(int)(Math.random()*upperLimit);
              if (i<lowerLimit) {
                   i=i+lowerLimit;
              answer=i;
         success = false;
    numGuesses = 0;

    implement synchronizable and createa constructor, then check it once again.

  • Invalid Cursor Position Error

    Help!
    I am using JRun3.1 and developing a web interface to a database. In this particular screen, I am using CachedRowSet (I downloaded this and added it to jrun classpath). I am getting "Invalid cursor position" error.
    I feel there is a problem with the usebean tag.
    This is my code:
    what is wrong with this?
    <%@ page language = "java" import="java.sql.*, java.util.*, javax.sql.*, sun.jdbc.rowset.*" %>
    <%
    String indSub = request.getParameter("indSub");
    String areaname = request.getParameter("selarea");
    %>
    <jsp:useBean id="crs" class="CachedRowSet" scope="session" >
    <%
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    crs.setUrl("jdbc:odbc:asphData");
    crs.setCommand("SELECT siccode, sicdesc from siccode where sictitle = '" + indSub + "'");
    crs.execute();
    %>
    </jsp:useBean>
    <%@ include file="header2.htm" %>
    <link rel="stylesheet" href="http://localhost:8100/empData/almis.css" type="text/css">
    <br>
    <br>
    <table align="center">
    <tr><td class="moduleDesign" align="center">Employers Database</td></tr>
    </table>
    <br><br>
    <font size="+2" face="verdana sans-serif">
    <form action="employerDetail.jsp" method="post">
    <p><center><font color="Blue">Employers in the �<%= indSub %>� Industry
    <br>
    SIC Code:�<%= crs.getString("siccode") %>
    <br>State: Utah<br>
    Region: �<%=areaname %><br>
    </font></center></p>
    <p>
    <b>Description:</b>�<%= crs.getString("sicdesc") %>
    </p>
    </form>
    <jsp:include page="footer2.htm" />
    </body>
    </html>
    srajaman2

    Never mind!
    I have to issue a next() command to get to the first line of the resultset!
    srajaman2

  • 500 Internal Server Error while connecting JSP with Oracle

    Hello Friends,
    We Have installed Oracle Applications 11i in our orgaization which run on HP-UX 11.11 (HP Unix). I have created a JSP file in which I am trying to connect the database using OracleConnectionCacheImpl Class File in oracle.jdbc.pool directory. But it shows an error message as:
    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
    More information about this error may be available in the server error log.
    I have also installed Oracle HTTP Server on my personal machine at which this code runs perfectly only the error comes when i try to connect oracle from Oracle HTTP Server installed on our HP Unix Server.
    the path for pool package is:
    /appltest/apps/prodora/iAS/oem_webstage/oracle/jdbc/pool
    the location of JSP file is:
    /appltest/apps/prodcomn/portal/TEST_test/test
    What I think is I have to play with the CLASSPATh entries, but dont know how. Please help me in solving this issue...
    For your reference the JSP code is:
    <%@ page import="java.sql.*, javax.sql.*, oracle.jdbc.pool.*" %>
    <jsp:useBean id="ods" class="oracle.jdbc.pool.OracleConnectionCacheImpl" scope="session" />
    <%
    try
    ods.setURL("jdbc:oracle:thin:@test:1546:test");
    ods.setUser("kpm_hr");
    ods.setPassword("kpm_hr");
    Connection conn = ods.getConnection();
    Statement stmt = conn.createStatement();
    Resultset rset = stmt.executeQuery("select first_name,last_name from kpm_hr.kpm_hr_emp_mst where empcode='P0580'");
    rset.next();
    out.println(rset.getString(1)+" "+rset.getString(2);
    catch(SQLException e)
    out.println(e);
    } Thanks in adavnce,
    Ankur

    Just to verify, which relevant log files have you found?
    catch(SQLException e) {
    out.println(e);
    } Have you search the console log file?
    A quick observation reveals that your jsp is just a standalone java program executed inside jsp. Suppose you just run it as a standalone program. Any error then?
    Another way going forward is to install oc4j standalone of the same version. It is very easy to install: just download the oc4j-extended.zip and unzip it and run "java -jar oc4j.jar". Put you jsp inside j2ee/home/default-web-app and run. You should see relevant log messages in j2ee/home/log/server.log and j2ee/home/application-deployments/yourApp/application.log.
    You should have Jdeveloper of some appropriate version installed. If you have not, install one. It might be not a little bit high learning curve at first, but the rewards are quick and amazing, especially since jdev 10.1.3. (I am speaking from my experience.) Try it with Jdeveloper.

  • How to assign the class value dynamically  in jsp:useBean ?its urgent

    Hi
    I want to set the class value of <jsp:useBean> dynamically
    when i am trying to this way
    <jsp:useBean id="<%=id %>" class="<%=beanclass %>" scope="request">
    <jsp:setProperty name="<%=id %>" property="*"/>
    </jsp:useBean>
    where beanclass is .class file that is to be used by the usebean tag
    i am getting following error
    The value for the useBean class attribute <%=beanclass %> is invalid.
    please help as soon as possible
    regards,
    Rameshwari

    You can not do that.The jsp:useBean and jsp:setProperty are action tags and not custom tags. Action tags get translated into Java code in the translation unit and are then compiled. Custom tag are backed by classes and the tag get translated into a method call of the class.

Maybe you are looking for

  • 2 iPods on the same iTunes / different libraries?  Possible?

    My girlfriend got a Nano for Christmas, but she only has Win98 on her computer at home. So instead of upgrading to Win XP (she'll do that down the road), she gave me her iPod and gave me a whole bunch of CD's she wants on her iPod. I ONLY want to put

  • Vertical text in JTabbedPanes on MAC

    Hi all, I use the CrossPlatformLookAndFeel for my Java application and I want to have vertical text in tabs with are placed on the left side. For displaying the vertical text I use a special TabbedPanUI (see code below) which rotates the text. This w

  • Creation of dump files

    i tried to take dumps of pages, contents areas, single sign on and so within an oracle portal environment. i created a transport set with .cmd extension but where should i run the script is it on windows command promt or oracle exp utility please hel

  • Text from CC behaves incorrect in CC 2014

    Hi Everybody, Currently I came across strange behaviour of the text created in CC but opened in CC 2014. Figure A shows how text looked like in CC also it shows how it looks like in CC 2014 in key line mode. Figure B shows how text looks like in CC 2

  • Firefox 9.0.1 + Adobe Flash 11 crash the PC!

    Hello I just have installed Firefox 9.0.1 (same behavior with FF 8), when I install the plugin Adobe Flash 11 to see any video on youtube, FF hang up inmediately when the first second of the video is loaded, and later the PC is hung up Is it a bug?