Trying to page import directive in a JSP  access a class in default package

I am trying to import a class the is in my default package directory for Tomcat 4.1.18 (context-root\web-inf\classes\*.java). I am getting the following error
This is error using Tomcat 4.1.18
org.apache.jasper.JasperException:Unable to compile class for JSP
C:\Program Files\Tomcat4.1\work\Standalone\localhost\csc297\HTML\SearchByName_jsp.java:9: '.' expected
import Product;
C:\Program Files\Tomcat4.1\work\Standalone\localhost\csc297\HTML\SearchByName_jsp.java:10: '.' expected
import Category;
This is error using Tomcat 4.0.6
org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
C:\forte4j\tomcat401\work\localhost\C_3A_5Cforte4j_5Ctomcat401_5Cwebapps_5Ccsc297\HTML\SearchByName$jsp.java:5: Class Product not found in import.
import Product;
^
C:\forte4j\tomcat401\work\localhost\C_3A_5Cforte4j_5Ctomcat401_5Cwebapps_5Ccsc297\HTML\SearchByName$jsp.java:6: Class Category not found in import.
import Category;
Here is snippet of code from my JSP:
<%@ page import= "java.util.*"%>
<%@ page import= "java.text.DecimalFormat"%>
<%@ page import="Product"%>
<%@ page import="Category"%>
Remember these classes are in my default package of my context-root
Any ideas would greatly appreciated

Weird error. Never seen this one before.
Try packaging your classes eg:package myClasses;and import them:<%@page import="myClasses.*"%>Should fix the problem.
Anthony

Similar Messages

  • JSP page import directive

    I'm running JSPs and servlets under Netscape (Tomcat) web server and am getting errors with my jsp file's first line:
    [%@page import="java.util.*, myclass" %]
    Netscape server throws an error saying that it can't import myclass. I've put the myclass.class file in various locations in the server but it still can't find it. Does anyone know a foolproof way to make the server find such a class when it's compiling jsp's?
    Thanks,
    David

    I think you have to specify package name of your class & not your calss name.

  • Importing class from default package of a JAR

    I want to create objects of a class contained in a JAR. The JAR has many classes in numerous packages, however the class that I want to use is in the default package. I'm using eclipse and have added the JAR to the build path, but eclipse complains that the class name cannot be resolved. Is there some way to specify an import statement to look in the default package of a particular JAR? Any advice is appreciated.

    jg2009 wrote:
    I was under the impression that classes without a defined package were technically considered to be part of the so-called default package. But, in answer to your question, yes this class does not appear to part of any package.
    Just to provide so additional information, the class that I want to instantiate is an Applet, so it is designed to be called from an html object tag, and have access to all of the other classes in its JAR. There is a system that provides access to underlying data via the following components: html form <-> javascript <-> applet <-> serverlets <-> data
    I want to automate certain data operations, but the only way to access the underlying data is via the applet. Am I out of luck, or is there some way that I can instantiate the applet?All jverd said is right, assuming it is your code and you can change it: basically move everything to a package. But I think your problem is that the jar is a 3rd party jar and you cannot change it. If this is the case, you can use the 'default package' (the terminology is correct) by having your own class(es) in the default package or by using reflection (last time I tried reflection would work). Both are rather bad solutions, but if you really, really want...
    Note: Java actively discourages the use of the 'default package' and more so recently, this is why I am not even sure that reflection would still work.

  • Importing classes from default package

    hey all,
    I've just started a new job, and find myself having to use a library that is written in the default package. At the moment, this is forcing me to put my classes in the default package whenever I want to use this library.
    using a line like:
    import RowBean;
    I get the following compiler error:
        [javac] C:\work\coyote\src\java\com\sok\coyote\Grievance\GrievanceActionServlet.java:8: '.' expected
        [javac] import RowBean;I've tried classic,modern and jikes - all with the same error.
    Eclipse seems to compile this happily, but I've been unable to find what it does to compile it.
    any ideas?
    cheers
    dim

    This works for me in 1.3.1_07
    DefaultPackage
    public class UseMe
         public static final String test = "Yes";
    }Package = fun
    package fun;
    import UseMe;
    public class Fun
         public static void main( String[] args )
              System.out.println( UseMe.test );
    }

  • JSP page import problems

    Hi,
    i've got a problem with importing java classes into my jsp file. i use the following method:
    <%@ page import="Person" %>
    Person is originally a selfwritten class which lies in the subdirectory WEB-INF/classes of my webapps directory of my tomcat server. when i use the above method i get the following error output:
    org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: 125 in the jsp file: /ShowPersonsView.jsp Generated servlet error:
    [javac] Compiling 1 source file 3 3 /usr/local/tomcat/work/Standalone/localhost/address/ShowPersonsView_jsp.java:7: '.' expected
    import Person;
    ^
    /usr/local/tomcat/work/Standalone/localhost/address/ShowPersonsView_jsp.java:231: cannot resolve symbol
    symbol : class Person
    location: class org.apache.jsp.ShowPersonsView_jsp
    Person tempperson;
    ^ An error occurred at line: 125 in the jsp file: /ShowPersonsView.jsp Generated servlet error:
    /usr/local/tomcat/work/Standalone/localhost/address/ShowPersonsView_jsp.java:238: cannot resolve symbol
    symbol : class Person
    location: class org.apache.jsp.ShowPersonsView_jsp
    tempperson = (Person)it.next();
    ^
    3 errors at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:120)
    at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
    at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:313)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:324)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:474)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:184)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
    at ShowPersonsPrepare.doGet(ShowPersonsPrepare.java:51)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    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:260)
    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:2396)
    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:170)
    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:223)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
    at java.lang.Thread.run(Thread.java:536)
    Thus, the Person class can not be found but i dunno why. Where do I have to make an entry? I already tried to set a classpath to this file, but it doesn't work. Has anyone an idea?
    Thanx

    Put the class in a package and call it accordingly. Example:
    WEB-INF
       |
        --- classes
               |
                --- example
                       |
                        --- Person.java
    //then in Person add:
    package example;
    //and in jsp
    <%@ page import="example.Person" %>

  • Trying to call a data bean from jsp

              I get the following error:
              C:\bea\user_projects\infologic1\.\myserver\.wlnotdelete\extract\myserver_BibleApp_BibleApp\jsp_servlet\__menu.java:146:
              cannot resolve symbol
              probably occurred due to an error in /menu.jsp line 27:
              Enumeration.categoryIds = categories.keys();
              code:
              menu.jsp
              <%@page import="java.util.*"%>
              <jsp:useBean id="DbBean" scope="application" class="showMeItNow.DbBean"/>
              <%
              String base = (String) application.getAttribute("base");
              %>
              <table width="150" cellpadding="5" height="75" cellspacing="0" border="0">
              <tr>
              <td>
              <form>
              <input type="hidden" name="action" value="search">
              <input type="text" name="keyword" size="10">
              <input type="submit" value="go">
              </form>
              </td>
              </tr>
              <tr>
              <td>category</td>
              </tr>
              <tr>
              <tr valign="top">
              <%
              Hashtable categories = DbBean.getCategories();
              Enumeration.categoryIds = categories.keys();
              while (categoryIds.hasMoreElements()) {
              Object categoryId = categoryIds.nextElement();
              out.println("<a href=" + base + "? action=browseCatalog&categoryId="
              + categoryId.toString() + ">" + categories.get(categoryId) + "</a><br>");
              %>
              web.xml
              <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
              "http://java.sun.com/dtd/web-app_2_3.dtd">
              <web-app>
                   <servlet>
                        <servlet-name>ControllerServlet</servlet-name>
                        <servlet-class>ControllerServlet</servlet-class>
              <init-param>
                   <param-name>base</param-name>
                   <param-value>http://localhost:7001/BibleApp/</param-value>
              </init-param>
              <init-param>
                   <param-name>imageURL</param-name>
                   <param-value>http://localhost:7001/BibleApp/</param-value>
              </init-param>
              <init-param>
                   <param-name>dbURL</param-name>
                   <param-value>jdbc:weblogic:mssqlserver4:users@COMPAQSERVER</param-value>
              </init-param>
              <init-param>
                   <param-name>usernameDbConn</param-name>
                   <param-value>dinesh</param-value>
              </init-param>
              <init-param>
                   <param-name>passwordDbConn</param-name>
                   <param-value>passs</param-value>
              </init-param>
              </servlet>
              </web-app>
              DbBean.class
              package showMeItNow;
              import java.util.*;
              import java.sql.*;
              import showMeItNow.Poll;
              public class DbBean {
              public String dbUrl="";
              public String dbUserName="";
              public String dbPassword="";
              public void setDbUrl(String url) {
              dbUrl=url;
              public void setDbUserName(String userName) {
              dbUserName=userName;
              public void setDbPassword(String password) {
              dbPassword=password;
              public Hashtable getCategories() {
              Hashtable categories = new Hashtable();
              try
              Connection connection = DriverManager.getConnection(dbUrl, dbUserName,
              dbPassword);
              CallableStatement cstmt = connection.prepareCall("{? = call dbo.categoryListing()}");
              //register the stored procedure's output paramater!!!
              cstmt.registerOutParameter(1, java.sql.Types.VARCHAR);
              cstmt.registerOutParameter(2, java.sql.Types.VARCHAR);
              ResultSet rs = cstmt.executeQuery();
              while (rs.next()) {
              categories.put(rs.getString(1), rs.getString(2) );
              rs.close();
              cstmt.close();
              connection.close();
              catch (SQLException e) {  }
              return categories;
              

    You might want to look at whether there is any data being fetched from
              the DB. Use some System.out.println()'s in the code where you fetch the
              data from the stored proc.
              Another way might be to comment out the database code, add some dummy
              values into the hastable and make sure that the page comes up as you
              expect.. and then go ahead with the database thingy..
              Nagesh
              dinesh wrote:
              > Thanks, the page is loading up. But, it is just blank. It is not displaying the
              > hastable data. Any ideas?
              >
              > thanks again,
              > Dinesh
              >
              > Nagesh Susarla <[email protected]> wrote:
              >
              >>>Enumeration.categoryIds = categories.keys();
              >>
              >>try replacing the dot '.' with a space and it should be all fine ..
              >>maybe a typo.
              >>
              >>Enumeration categoryIds = categories.keys();
              >>
              >>--
              >>Nagesh
              >>
              >>
              >>dinesh prasad wrote:
              >>
              >>>I get the following error:
              >>>
              >>>C:\bea\user_projects\infologic1\.\myserver\.wlnotdelete\extract\myserver_BibleApp_BibleApp\jsp_servlet\__menu.java:146:
              >>>cannot resolve symbol
              >>>probably occurred due to an error in /menu.jsp line 27:
              >>>Enumeration.categoryIds = categories.keys();
              >>>
              >>>
              >>>code:
              >>>
              >>>menu.jsp
              >>>----------
              >>><%@page import="java.util.*"%>
              >>><jsp:useBean id="DbBean" scope="application" class="showMeItNow.DbBean"/>
              >>>
              >>><%
              >>> String base = (String) application.getAttribute("base");
              >>> %>
              >>>
              >>>
              >>><table width="150" cellpadding="5" height="75" cellspacing="0" border="0">
              >>><tr>
              >>><td>
              >>><form>
              >>><input type="hidden" name="action" value="search">
              >>><input type="text" name="keyword" size="10">
              >>><input type="submit" value="go">
              >>></form>
              >>></td>
              >>></tr>
              >>><tr>
              >>><td>category</td>
              >>></tr>
              >>><tr>
              >>><tr valign="top">
              >>>
              >>> <%
              >>> Hashtable categories = DbBean.getCategories();
              >>> Enumeration.categoryIds = categories.keys();
              >>> while (categoryIds.hasMoreElements()) {
              >>> Object categoryId = categoryIds.nextElement();
              >>> out.println("<a href=" + base + "? action=browseCatalog&categoryId="
              >>>+ categoryId.toString() + ">" + categories.get(categoryId) + "</a><br>");
              >>>}
              >>>
              >>> %>
              >>>-------------------------------------------------------------------------------------
              >>>
              >>>web.xml
              >>><!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
              >>
              >>2.3//EN"
              >>
              >>>"http://java.sun.com/dtd/web-app_2_3.dtd">
              >>>
              >>><web-app>
              >>>     <servlet>
              >>>          <servlet-name>ControllerServlet</servlet-name>
              >>>          <servlet-class>ControllerServlet</servlet-class>
              >>>     
              >>><init-param>
              >>>     <param-name>base</param-name>
              >>>     <param-value>http://localhost:7001/BibleApp/</param-value>
              >>></init-param>
              >>>
              >>><init-param>
              >>>     <param-name>imageURL</param-name>
              >>>     <param-value>http://localhost:7001/BibleApp/</param-value>
              >>></init-param>
              >>><init-param>
              >>>     <param-name>dbURL</param-name>
              >>>     <param-value>jdbc:weblogic:mssqlserver4:users@COMPAQSERVER</param-value>
              >>
              >>></init-param>
              >>><init-param>
              >>>     <param-name>usernameDbConn</param-name>
              >>>     <param-value>dinesh</param-value>
              >>></init-param>
              >>><init-param>
              >>>     <param-name>passwordDbConn</param-name>
              >>>     <param-value>passs</param-value>
              >>></init-param>
              >>> </servlet>
              >>></web-app>
              >>>     
              >>>          
              >>>-----------------------------------------------------------------------
              >>>DbBean.class
              >>>
              >>>package showMeItNow;
              >>>
              >>>import java.util.*;
              >>>import java.sql.*;
              >>>import showMeItNow.Poll;
              >>>
              >>>public class DbBean {
              >>> public String dbUrl="";
              >>> public String dbUserName="";
              >>> public String dbPassword="";
              >>>
              >>> public void setDbUrl(String url) {
              >>> dbUrl=url;
              >>> }
              >>>
              >>> public void setDbUserName(String userName) {
              >>> dbUserName=userName;
              >>> }
              >>>
              >>> public void setDbPassword(String password) {
              >>> dbPassword=password;
              >>> }
              >>>
              >>> public Hashtable getCategories() {
              >>> Hashtable categories = new Hashtable();
              >>> try
              >>> {
              >>> Connection connection = DriverManager.getConnection(dbUrl,
              >>
              >>dbUserName,
              >>
              >>>dbPassword);
              >>>
              >>> CallableStatement cstmt = connection.prepareCall("{?
              >>
              >>= call dbo.categoryListing()}");
              >>
              >>> //register the stored procedure's output paramater!!!
              >>> cstmt.registerOutParameter(1, java.sql.Types.VARCHAR);
              >>> cstmt.registerOutParameter(2, java.sql.Types.VARCHAR);
              >>> ResultSet rs = cstmt.executeQuery();
              >>> while (rs.next()) {
              >>> categories.put(rs.getString(1), rs.getString(2) );
              >>> }
              >>> rs.close();
              >>> cstmt.close();
              >>> connection.close();
              >>> }
              >>> catch (SQLException e) {  }
              >>> return categories;
              >>> }
              >>>
              >>>}
              >>>
              >>>
              >>>
              >>
              >
              

  • JSP cannot load class from classpath

     

              Ken:
              I run into this problem yesterday too. I'm wondering if you have it resolved? Thank you very much!
              Lucy
              Ken Rimple <[email protected]> wrote:
              >All,
              >
              >I'm using 5.10 WLS, and have a jsp that is trying to access a class in a
              >package loaded in my java classpath. I'm using visual cafe expert
              >edition, and the class is part of the project classpath. To be safe,
              >I've also put it in the sc.ini file under CLASSPATH.
              >
              >The jsp keeps failing with the following error. Servlets I'm using
              >place these things in the HttpSession and are called before this page
              >and they work. I'm baffled, as I even tried the jspc compiler utility
              >adding the classes to the class path.
              >
              >Parsing of JSP File '/ShowResults.jsp' failed:
              >--------------------------------------------------------------------------------
              >
              > /ShowResults.jsp(4): Could not create a bean of type:
              >com.<companyname>.<software>.common.UserSession:
              >java.lang.ClassNotFoundException: class
              >com.<companyname>.<software>.common.UserSession :
              >java.lang.InstantiationException:
              >com/<companyname>/<software>/common/UserSession
              >probably occurred due to an error in /ShowResults.jsp line 4:
              ><jsp:useBean id="user_session" scope="session"
              >class="com.<companyname>.<software>.common.UserSession" />
              >--------------------------------------------------------------------------------
              >
              >(<companyname> and <software> are regular names. The file is in the
              >class path and is used by Servlets.
              >
              >It's almost as if the jsp compiler is ignoring any class paths.
              >
              >Please help if anyone has made this work. I'm stuck.
              >
              >Ken Rimple
              >
              >
              

  • JSP Debbuging -Error: 'class' or 'interface' expected-

    Hi,
    Does anybody know why am I getting the following error when trying to either debug or run a JSP?
    Error: 'class' or 'interface' expected
    This happens with JDeveloper 9.0.2.829
    It was running just OK, when running from the Navigator Panel (Right click -> Run test.jsp)
    But, when I tried to run the JSP from the Debug Icon -that debugs the whole project-, I got the error I already mentioned.
    Thanks in advance for your help
    Agutin

    Hi,
    Does anybody know why am I getting the following error when trying to either debug or run a JSP?
    Error: 'class' or 'interface' expected
    This happens with JDeveloper 9.0.2.829
    It was running just OK, when running from the Navigator Panel (Right click -> Run test.jsp)
    But, when I tried to run the JSP from the Debug Icon -that debugs the whole project-, I got the error I already mentioned.
    Thanks in advance for your help
    Agutin

  • Multiple import directives in jsp

    I have a JSP and in my page directive I have an import as follows: import="java.util.*" which works fine
    However if I add another one eg import="java.text.*" I get an error message because it only seems to pick up one import. Anydbody know what is going wrong?
    Thanks!!

    Not exactly sure whats wrong here because I can't see all your code, but you can definetely import more than one class like this:
    <%@ page import="java.util.*, java.text.*" %>

  • Where to add directive on a JSP page?

    Do we have t o add a directive like an import packages directive, on the top of the JSP page ONLY. Or can we place it anywhere in the file ...may be just above when you have the java code.
    Example:
    Should I place:
    <%@ page import = "java.util.*, java.lang.*,java.text.* " %>right above my <html> tag or can I place it inside my <body> wher eI have some code Example:
    String i="123";
    int k= Integer.parseint(i);Will that change the way the JSP works?
    I know that compiling is done top to bottom, but how does it effect the performance?
    Are all directives loaded initially, when the program is run?
    Thanks,
    Kishore

    It's good to add it on top of the file. But for your code to work, you are required to add directive at least before you write any java code in your jsp file.

  • Directive page import

    pleze
    can i import all packages in java api with directive page import ?
    <%@ page import="anypackage" %>
    or just some packages and if it , what are these packages can i import ?
    thanx

    The JSP import works just like a Java import. You can import everything in a directory, non-recursively.
    E.g.:
    <%@ page import="java.awt.*" %>
    Gets all of the imports under java/awt/, e.g. "java.awt.LayoutManager". But if you need an AWT event, such as "FocusEvent", then you have to go down one more layer, e.g.:
    <%@ page import="java.awt.event.*" %>
    You can repeat the "page import" as many times as you need to import the classes you're using.
    Hope that answers the question?

  • CHART BUILDER ERROR WHEN TRYING TO GENERATE DYNAMIC CHARTS ON A JSP PAGE

    I'm working with J Develop 9.03 on Windows 2000 Professional Edition.
    I'm using the JSP demo files provided with Oracle Chart Builder to generate
    dynamic charts. The user specifies the query parameters, including the date
    range and the query results are returned by means of a line chart (with date on
    the x axis and values on the y axis).
    When trying to compile the project I get the following error messages:
    Error(165,2): class FileOutputStream not found in class _graph
    Error(170,5): class File not found in class _graph
    Error(176,4): exception java.io.IOException is never thrown in the
    corresponding try block
    I checked to see that the chartbuilder library (chartbuilder.jar) files are
    loaded into the project library. It's unusual that the class is not being
    found. I don't understand why. I developed my project using the following steps:
    1. Unzipped Chart Builder installation files into c:\Oraclechartbuilder
    2. Loaded chartbuilder class library
    c:\Oraclechartbuilder\chartbuilder\lib\chartbuilder.jar into J Developer class
    path (by selecting <Project Settings> <Paths> and browsing to the
    chartbuilder.jar file).
    3. Created a new JSP page in J Developer (graph.jsp)
    4. Copied JSP code syntax from the Word Pad demo file and pasted into graph.jsp
    5. Changed the DB connection parameters and static directory location on the
    JSP page.
    6. Compiled the project and received the above errors.
    I would like to know why the classes are not being found and how to fix the problem. Thanks, Jaafar

    Hi mshah101,
    This can happen if the applet is compiled using an higher version of java and the browser is pointing to an older version (even if minor version number is higher)

  • Jsp:useBean vs page import in JSP

    Hi,
    What is the difference between jsp:useBean vs page import in JSP?
    By using page import also I can call the method of the class, apart from jsp:useBean does have scope associated with it. I don't think there is any change between both the 2. Yes by using jsp:useBean we can set the property and get the property as well.
    Is there any major differences between the 2 and when to use which ? Please clarify.
    Thanks.

    797836 wrote:
    Hi,
    What is the difference between jsp:useBean vs page import in JSP?
    By using page import also I can call the method of the class, apart from jsp:useBean does have scope associated with it. I don't think there is any change between both the 2. Yes by using jsp:useBean we can set the property and get the property as well.
    Is there any major differences between the 2 and when to use which ? Please clarify.
    Thanks.Yes there is a difference.
    If you use import, then you have to create/use the reference object to use the class methods. And you can't define the scopes like session, page .. etc. Apart from this you will be using scriptlets <% %>.
    if you are using jsp:useBean , then you can skip the above activities. useBean takes care of it.
    or you can say jsp has provided a utility to access the beans without creating its object or using scriptlets.

  • Trying to include an applet in a JSP page

    Hello,
    I have a jsp page trying to include an applet class in it.
    Both of them are part of a war file put on an apache server.
    The directories tree looks like this :
    root
    MyJSPPage.jsp
    WEB-INF
    classes
    MyDir
    MySubDir
    MyApplet.class
    In MyJSPPage.jsp, the code looks like this :
    <jsp:plugin type="applet"
    code="MyApplet.class"
    codebase="/WEB-INF/classes/MyDir/MySubDir">
    </jsp:plugin>
    When loading the page on my browser, it fails, and the java console indicates the following :
    java.lang.ClassNotFoundException: MyApplet.class
         at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:153)
         at sun.plugin.security.PluginClassLoader.findClass(PluginClassLoader.java:168)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
         at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:114)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
         at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:506)
         at sun.applet.AppletPanel.createApplet(AppletPanel.java:567)
         at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1778)
         at sun.applet.AppletPanel.runLoader(AppletPanel.java:496)
         at sun.applet.AppletPanel.run(AppletPanel.java:293)
         at java.lang.Thread.run(Thread.java:536)
    I tried several things for codeBase :
    codebase="/WEB-INF/classes/MyDir/MySubDir"
    codebase="/MyDir/MySubDir"
    codebase="MyDir.MySubDir"
    without any success.
    Could you tell me what is wrong?
    Thanks in advance,
    Olivier

    Hello,
    I tried what you proposed.
    It continue to fail. I think I haven't give you the whole stack :
    charger : classe MyClass.class introuvable.
    java.lang.ClassNotFoundException: MyClass.class
         at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:153)
         at sun.plugin.security.PluginClassLoader.findClass(PluginClassLoader.java:168)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
         at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:114)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
         at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:506)
         at sun.applet.AppletPanel.createApplet(AppletPanel.java:567)
         at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1778)
         at sun.applet.AppletPanel.runLoader(AppletPanel.java:496)
         at sun.applet.AppletPanel.run(AppletPanel.java:293)
         at java.lang.Thread.run(Thread.java:536)
    Caused by: java.io.IOException: open HTTP connection failed.
         at sun.applet.AppletClassLoader.getBytes(AppletClassLoader.java:252)
         at sun.applet.AppletClassLoader.access$100(AppletClassLoader.java:42)
         at sun.applet.AppletClassLoader$1.run(AppletClassLoader.java:143)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:140)
    What ca this HTTP connection failed stuff be?
    Help, thanks in advance,
    Olivier

  • Jsp import directive

    i just installed tomcat 4.1.18 and pretty much copied over all my applications and did the configurations in the server and web files...the only problem i noticed was that importing classes not part of the java libraries throws a jsp init() exception.
    is the syntax still the same:
    <@page import ="java.util.*,MyJavaBean" %>
    in this case it complained about the MyJavaBean as an unrecognizable object, however it is in the WEB-INF/classes folder for this app. This syntax works for tomcat 4.0.1

    Hi,
    As I know in Tomcat 4.1.x you have put your classes into packages. Putting the classes into WEB-INF/classes directory is not enough. You should try the following:
    1. create a directory test under WEB-INF/classes directory and put your MyJavaBean class into this directory.
    2. add the following line to the top of your MyJavaBean.java
    package test;
    3. Compile as : javac test/MyJavaBean.java
    Try this...
    nurettin

Maybe you are looking for

  • Starting Actions in Adobe Acrobat Pro

    Dear Adobe Acrobat users, I know that Adobe Acrobat isnt designed to be operated through the command line. However, I was wondering whether it might be possible to start/initiate Actions that have been created with the Action Wizard from outside Adob

  • Sharpening export workflow question

    I have a sharpening workflow question. Say I have pictures from a portrait session I just finished. I have to send 10 pictures the client ordered to a print lab and I also will make some small facebook sized pictures and upload them to my business fa

  • Where are digital signatures stored?

    I can't find the digital signature I created a while back. I know the password but can't find where it is stored. Help would be appreciated. Thanks. PS. Mac OSX 10.5.5 Acrobat 9

  • Unscheduled re-boots

    I have experienced 11 unscheduled re-boots since purchasing my iMac in February. Is this normal for OS X computers? Coming from a Windows world I have not had a BSOD or unscheduled re-boot in years on either Win 7 or 8. Is this covered under AppleCar

  • Order nUmber during production order create.

    Hi All, Please tell me the setting that I need to do so that Production order number is generated during Order creation. right now the number is generated during order saving and not during order create.