13 default packages in JSP

Can anybody tell what are the 13 default packages in JSP.
Thanks in advance!!!

not entirely sure what you mean but the following are imported implicitly in all JSPs:
java.lang.*
javax.servlet.*
javax.servlet.jsp.*
javax.servlet.http.* hth,
m

Similar Messages

  • 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

  • Import class file in default package (netbeans) into my jsp

    Hello all I have created a class file in the default package under Source Files in the netbeans 5 ide.
    I am having a problem importing that class file into my jsp(which resides in the Web Pages directory .
    I tried the following:
    <jsp:useBean id="dial" class="Test" scope="session" />
    my class file is Test.java
    Any help or explanation would be greatly appreciated.
    TIA!

    Will not work. Classes have to be defined in a package, the default package just wont do.
    ram.

  • Import Java package in JSP

    I hope this is an appropriate forum for this query.
    I want to be able to access a user-created Java package in JSP.
    I have this code:
    <%@page import="TPClass.*" %>
    <%
    xxx = TPClass
    session.setAttribute("response",xxx.GetTPResponse());
    %>
    The error display points to TPClass in the import statement with the message "TPClass not found".
    TPClass files are in the same location as the other project files.
    I have creatyed and compiled the TPClass package.
    Is there more I need to do?
    Brenton

    I think you are very new to java....
    anyway
    <%@page import="class name with full qualified package name"%>
    like
    <%@page import="com.x1.x2.TPClass"%>
    <%
    TPClass cls =new TPClass();
    //then do whatever you want...
    %>
    hope u understand now.....

  • How to save library symbols' class files in packages that are not the default package?

    Hi,
    I perform the following in Flash CS5 with Flash Builder 4
    1) Create a new library symbol.
    2) Do a RightClick->Properties on the new symbol
    3) Check the options for "Export for ActionScript" and "Export in frame 1".
    4) I write a new name for my class "Class1" and click on the pencil icon "edit class definition" to edit the class.
    At this point my FlashBuilder 4 takes over and opens the "New ActionScript" dialog.
    4) I then click on Package-Browse to select a package e.g. com.mycompany.myfiles as the new class destination.
    The as file is created as com.mycompany.myfiles/Class1.as as everything seems just fine.
    5) I close the ActionScript file and back in Flash CS5 I RightClick on the symbol and select "Edit Class".
    At this time, FB4 suggests again to create the file, ignoring the fact that I already created it before.
    Do you know of a way I can make Flash CS5 remember where I created the file?
    Thanks.

    Hi,
    I didn't remove the project or delete any of the files.
    All I did was create the class file under a package that is not the default package. Then when I clicked on the Flash symbol's "Edit Class" It asked me again to create the same class file.
    Only if I create the class in the default package, it won't ask me to recreate it again.
    Bye,
      RaamEE-IL

  • 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.

  • Call PL/SQL packages in JSP

    I would like to call PL/SQL packages in JSP. I am new in Java world. So, kindly tell code about to call packages from oracle. I will be thankful to all those experts who will help a student such as me.
    I will be anxious to your response.
    plz
    plz

    Dear sir,
    I am really thankful to you. I have to verify password in oracle.
    Id and password verification is writting in package's function. Id and password are oracle users. Like scott in Oracle. I think it is possible.
    Kindly assist me.
    If u feel easy then kindly contact me at [email protected] or tell me your email address. Plz

  • 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 );
    }

  • Using a package in JSP

    Hi,
    I've been learning java at Uni using the Elements Package. I've started learning JSP on my own and was wondering if i can use the package with JSP. For example if i wanted to use this code
    import element.*;
    import java.awt.Color;
    public class test
    public static void main(String args[])
         DrawingWindow d = new DrawingWindow();
         ConsoleWindow q = new ConsoleWindow();
    is it possible?

    You cannot have a main() method in a JSP. The JSP will be compiled (behind the scenes) by your J2EE container (Tomcat, Weblogic, JBoss, etc.) into a Servlet. As such, you have access in your JSP to the HttpServletRequest and HttpServletResponse, as well as the HttpSession, the Servlet OutputStream, and a few other Servlet variables. You write normal Java code within the JSP (or use a JSTL tag lib) between <% and %> blocks. You can import any package in your JSP that is in the web application's classpath.
    - Saish

  • Not  able to access default package classes in own package

    I created a class called Constant.java in default package(no package ).
    I have Connection.java in util package.
    I am trying to use the Constant.java in my Connection.java like below..
    public class Constant
         public static final String NEW = "01";
    package util;
    import Constant;
    public class Connection
    I am unable to compile the class Connection. My question here is Won't I able to access default package in my util package.. ?

    java_guy04 wrote:
    Djaunl , I understand.
    but, Will I able to access default package in my util package.. ? is this correct.No, you won't be able to use classes out of the "default" package.
    Because, AFAIK, if you use a classname that you haven't imported, Java automatically attempts to locate this class in the same package as the current class. It does not check the "default" package (unless that is also the current package), and since the "default" package does not have a package name, you can't import those classes either.

  • Need to use default package for JNI code?

    Hi,
    I don't have much experience with JNI code, so excuse me if I make a silly mistake.
    I have a set of DLLs to interface with Microsoft native speech code ("Microsoft Sam") -- a GPL library called Quadmore. Quadmore has some sample Java code to work with the libraries, all of which they put in the default package (no package). If I move their code to a named package, it breaks. The Java code is able to load th libraries, but can't find any of the methods.
    Looking at the source for their DLLs (though I don't speak C++), the method names are things like
    JNIEXPORT jboolean JNICALL Java_QuadmoreTTS_SpeakDarling(JNIEnv *env,jobject obj,jstring strInput)As far as I understand, this implies that the QuadmoreTTS.class that calls the code must be in the default package, as otherwise the method name needs to be prepended with a package name.
    If that's so, then there's no way I can use the code as-is, right? Naturally, the rest of my program is in named packages, and I can't import any class that is in the default package, right? I've tried placing all their code in a jar and adding the jar to my classpath, but I still can't import any of their classes as they are in the default package.
    Is the only solution to re-compile all their C/C++ code to let it use packages? Am I being dumb and missing something? I'm pretty sure other people have used Quadmore before, so I can't believe that they've never had this problem before.
    Any suggestions greatly appreciated!
    Sam

    C/C++ functions in JNI must conform to the prototypes produced by running the javah compiler against the class file with native methods in it. So if you move the class to another package, the prototypes change. If you doun't change the compiled C coudes to suit, you will get undefined method errors when you load the dll as the JVM won't be able to match the native methods to the methods in the dll (it will call WinLoadLibrary() and WinLoadProcAddress() or somesuch under Windows).

  • Default/package/none access modifier

    Hi,
    I was hoping for some discussion on the default/package/none access modifier. It's always really bugged me that we have public, private, protected, and then "none", while it seems to me that it would be less confusing, and more consistent to use the keyword "package", or maybe even "default".
    Then, source code would look like
    public class MyClass{
        public int getValue() {}
        private void setValue() {}
        protected void someMethod() {}
        package int justForPackage() {}
    }I know this concept has come up before, but the books I've read which mention this topic haven't offered any actaul justification/explanation for why there isn't some keyword.
    Anyway, are there any insights as to why java is this way, and any reasons why java should or shouldn't be changed to include the package access modifier.

    A good example is within a tightly grouped package (usually should be this way) you may have some cooperative classes that access methods.
    // one .java file
    public class SomeHelper {
       private void method() {
         new ClassForUsers().accessHiddenLogic();
    // next .java file in same package
    public ClassForUsers {
        /* default-access */ void accessHiddenLogic() {
    }But, you may want to allow users to subclass your ClassForUsers, without giving them access to the hidden logic method directly:
    // another .java file in a different package
    public class UsersSubclass extends ClassForUsers {
        public void userMethod() {
            // can't do this
            accessHiddenLogic();
    }This could be for either business logic or security reasons. So, package level access can be very useful. However, I've seen that in practice it is avoided because it isn't obvious what is going on.

  • Netbeans - refactoring from in a package to the default package

    Hello,
    I have a problem, I have some JNI code (two .dll's) and a wrapper that connects my java program to an external USB board.
    I didn't write the original code, that was done by Mike Peter and the dlls have been compiled so that I can call the JNI functions only in the default package. Whenever I try to put the code in a package of its own, the JNIs stop working. So my problem now is that I want to access this interface class from my code that is in a package.
    I don't know how to import the code as a library into my programs package so perhaps a solution might be to de-package my program code so that it can access Mike Peters code.
    Trouble is I have used the netbeans GUI editor that does not let me access all the code and I dont know how to refactor the package from being in one to not being in one.
    removing the package declartion from my code manually causes lots of errors.
    Any ideas?
    Mike Peters code downloadable here:
    http://www.re-applications.be/downloads/J-K8055-Wrapper.zip
    the usb_interface class has no constructor and is not in a package, how do I go about making it a library and importing it?
    I'd greatly appreciate it if anyone can help, if more details are needed I can try to provide them but I didn't think it was worth putting up all my code here as there is no real problem with it, just an access issue.

    What I really need to do is find a way to import a class from the default package.
    I was led to believe that classes in the default package should be readily accessible, however my compiler says otherwise when my code is in a package and the class I want to access can only be accessed when my code is not in a package. This is really frustrating because the GUI editor doesn't like it when the GUI is not in a package... so I either lose and my USB interface doesn't work or I lose and my GUI doesn't work.
    help!

  • Compiling java package class referring a default package class.

    I am trying to compile a java class having a package defination referring a java class with a default package.
    The code for the default package class is .
    public class Test{.
    public static void main(String[] args){
    System.out.println("Hello World!");
    This class compiles fine.
    I have another class called PackJava, whose code is :
    package test;
    import Test;
    public class PackJava{
    public static void main(String[] args){
    Test test = new Test();
    System.out.println("Hello World!");
    I have Test file in the windows path
    D:\development\packagetest\example
    and the PackJava java file in the path
    D:\development\packagetest\example\test
    I have set the CLASSPATH environment varibale as
    D:\development\packagetest\example;.
    When I try to compile the PackJava from the
    D:\development\packagetest\example path giving the command as
    javac -classpath . test\PackJava.java
    or
    javac -classpath %CLASSPATH% test\PackJava.java
    it gives me error,
    Do any of you have an idea of the parameter i should pass
    to the -classpath option
    Thanks

    There is a way around all this. The classes in the default packages need to implement an interface with the methods require. The interface can be in any package you want ie. com.work.around.interf.MyInterface1. Next, make this interface available in a Singleton. - The only catch here is that, the main method must reside in default package as well. And o, on start of main, instantiate the class you want and put it in the singleton. There after, you may refer to it from the singleton.
    Enjoy.

  • Access Class in Default Package

    Make long story short, I have to have some class in the "(default package)", related to JNI, and I will need to pass data back and forth from and to these classes from some packaged classes. I am using Java 1.4. As I know since Java 1.4, it's not possible to access classes in default package from packaged classes directly. Is there a work around? please help...

    I DON'T have the C/C++ codeSo you have to do with the "old" classes in the default package.
    Then use jschell's suggestion to devise proxying code that allow bridging between the packages.
    since Java 1.4, I can't call the java class in the default package from packaged class any moreIf I understand jschell's post, this restriction is enforced by the Java compiler , not by the Java interpreter (JVM). Indeed this is specified in the JLS (Java Language Specifications, http://java.sun.com/docs/books/jls/third_edition/html/packages.html#7.5), not the JVM specifications (I have not verified that latter point).
    So if you get an older JDK (before 1.4 they would accept the construct), you can try writing proxy classes within a named package, proxying to the old classes in the unnamed package. Once they are compiled, and jarred together for convenience, you can switch back to the current compiler (let's says 1.6) to compile the rest of your application classes, which only use the classes in the named package, using the jar as a library.
    When executing the program, the JVM will execute everything without complaining, since it supports execution of compiled code that has been compiled with former versions.

Maybe you are looking for

  • Calling stored procedure of db2 database

    i'm quiet new to jdbc & db2.I have been successful in simple query actions between java + db2 but while using a simple SQL based stored procedure,the following error occured: COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL1109N The speci

  • Is this how a request is processed?

    OK, from the first request made in an application, let's say we have the following things in our application.cfc: ooML = Out of Method Logic (logic that is in the application.cfc, but not in any method) oAS = onApplicationStart oRS = onRequestStart o

  • (winxp+oracle11g) The em page can not be opened.

    I am struggling with the OEM these days and stunned by an error. When i input https://myhostname:1158/em in ie ,it always shows that 503 Service Unavailable Servlet error: An exception occurred. The current application deployment descriptors do not a

  • How to transfer movie to ipod classic? Other questions too

    I have been using an ipod mini for ages, just gave it to my daughter and bought a 80gb ipod classic. When I set up sync movies, does it copy every movie from my movie folder to my ipod? It doesn't seem to work even I set it up properly. Can I copy mo

  • N82 Camera won't turn on.

    After using the phone for a year now the camera suddenly will not turn non when I hit the switch on the back of the phone. Any idea what can be wrong, or does it need a repair? Maria