SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Jul 2008
    Posts
    154
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to reference another Java class from JSP?

    Hi!

    I have some code in databaseAccess.java file and I want to reference it by calling it from a jsp file.

    In my jsp file, I have:

    <&#37;
    databaseAccess db = new databaseAccess();
    db.query("SELECT....");
    %>

    But it gives me a HTTP 500 error report. It says: cannot find symbol
    symbol : class databaseAccess

    Do I need to "reference" the databaseAccess.java in my jsp file? How should I do it?

    Thanks.

  2. #2
    SitePoint Wizard silver trophy rushiku's Avatar
    Join Date
    Dec 2003
    Location
    A van down by the river
    Posts
    2,056
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Just like regular Java, you'll need to import a class or package you want to include in your code.

    Like so:

    <&#37;@ page import="java.text.*, java.util.*" %>

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2008
    Posts
    154
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •