Actual Mechanism of Object class as Parent Class to all the classes

Hi All,
We know that all the classes in the java platform are descendants of Object class. Even if we are writing a new class also, in the absence of any other explicit superclass, every class is implicitly a subclass of Object. As we are not extending the Object class directly, then how come the methods in the Object are inheriting to the Sub class what we have written? How the java maintain this heirarchy?
Can you please explain this elaborately?
Thanks in Advance,
Uday

Udaya Shankara Gandhi wrote:
Hi All,
We know that all the classes in the java platform are descendants of Object class. Even if we are writing a new class also, in the absence of any other explicit superclass, every class is implicitly a subclass of Object. As we are not extending the Object class directly, then how come the methods in the Object are inheriting to the Sub class what we have written? How the java maintain this heirarchy? Because the language is defined that way. Compilers implement the language according to the rules of the JLS. Exactly how they do that is undefined. It's up to each compiler. As long as it follows the rules defined in the JLS for parsing the code and generating the .class file, that's all that matters. However, somewhere in the compiler is code that does approximately this:
if (class has an extends clause) {
  generate corresponding bytes for extends in .class file
else {
  generate bytes for extends java.lang.Object in .class file
}No great mystery, nor philosophical question.

Similar Messages

  • Adding all the classes and external jars in webservice WAR using servicegen

    Hi,
    Can someone please tell me how do I include all the classes and my external jar files to the ear/war file that is created using servicegen. I don't see any option in servicegen tag where I can include my classes and jar files to the ear/war file. The war it creates only contains the web service implementation class but I want to all the classes in the service code and jars in the same war. Any ideas on how to do that instead of putting in the classpath.
    here is the snippet of my build file
    <servicegen
           destEar="${deploy}/myservice.ear"
           warName="myservice.war">
           <service
             javaClassComponents="com.ws.service.TestService"
             targetNamespace="http://xmlns.test.com/tool/myservice"
             serviceName="myservice"
             serviceURI="/myservice"
             style="document"
             protocol="http"
             expandMethods="True">
           </service>
          <classpath>
            <pathelement path="${classes}"/>
            <pathelement path="${lib}/*.jar"/>
         <pathelement path="C:/bea/weblogic92/server/lib/webserviceclient.jar"/>
          </classpath>      
    </servicegen>
    ..........................Thanks

    Hi,
    The work around I am using to overcome this problem is Unzipping th ear/war file created by servicegen task and including all the classes. Then creating the ear file again by creating a new ant target.
    I know this is not a neater way, but this works for me.

  • How to keep track of all the classes/methods/properties created in a long script

    Hi,
    I'm curious to know what method people use to keep track of all the classes, methods, and properties you've created when writing a longer script.
    For quick scripts, this isn't a problem. But for long scripts it can get quite difficult to keep track of all the objects one has created, and all their methods and properties, and overloaded constructors, etc.
    ESTK is great, and it's the IDE I use for InDesign scripting, if only because of it's powerful debugging options.
    But it doesn't provide any way of keeping track of this stuff. No proper Intellisense as in Visual Studio.
    I'd be interested to hear how people solve this issue.

    Hi Ariel,
    Not sure it is relevant to your question but I have an old snippet that collects and displays ExtendScript references using $.list(). This may help to track some object relationships.
    // WARNING: this is just a WIP -- Not tested in all platforms and versions
    $.scanRefs = function scanRefs(/*0|1*/showAll)
        var s = $.list(),
            p = (!showAll) && s.indexOf('[toplevel]'),
            a = ((!showAll) ? s.substr(0,10+p) : s).split(/[\r\n]+/),
            n = a.length,
            // --- Address:1     L:2  Rf:3   Pp:4  Type:5  Name:6
            re = /^([0-9a-z]{8}) (.) +(\d+) +(\d+) (.{10}) (.{1,17})/,
            reTrim = / +$/,
            i, t, k, m,
            refBy, type, name, tag, rest, rfCount, props, j,
            o = {},
            TYPES = {'Function':"FCT", 'Object':"OBJ", 'Array':"ARR", 'RegExp':"REG"};
        for( i=2, refBy=0 ; i < n ; ++i )
            s=a[i];
            while( s && m=s.match(re) )
                k = '&'+m[1].toUpperCase();
                rfCount = parseInt(m[4],10);
                rest = s.substr(m[0].length);
                type = m[5].replace(reTrim,'');
                name = m[6].replace(reTrim,'');
                if( 0x5B==rest.charCodeAt(0) )
                    p = rest.indexOf(']');
                    tag = rest.substr(0,1+p);
                    rest = rest.substr(1+p);
                else
                    tag = '';
                if( 0x20==rest.charCodeAt(0) )
                    rest=rest.substr(1);
                if( p=!(rest.indexOf("referenced by:")) )
                    rest = rest.substr(14);
                o[k] || (o[k] = {
                    locked:        +('L'==m[2]),
                    rfCount:    parseInt(m[3],10),
                    ppCount:    rfCount,
                    type:        TYPES[type]||type,
                    name:        name,
                    tag:        tag,
                    from:        [],
                    order:        -1,
                if( 0 < refBy )
                    if( p || !rest ){ throw "Unable to parse references." }
                    props = rest.split(' ');
                    refBy -= (j=props.length);
                    while( j-- ) t.from.push([k,props[j]]);
                    (props.length=0)||(props=null);
                    rest = '';
                else
                    refBy = rfCount;
                    if( p != !!refBy )
                        if( p ){ throw "Unable to parse references."; }
                        refBy = 0;
                    (t = o[k]).order = n - i;
                (m.length=0)||(m=null);
                s = rest;
        a.length=i=0;
        for( k in o )
            if( !o.hasOwnProperty(k) ) continue;
            a[i++] = k;
        a.sort( function(x,y){return o[x].order-o[y].order;} );
        //a.sort( function(x,y){return parseInt(x.substr(1),16)-parseInt(y.substr(1),16);} );
        var u,
            pngLock = "\x89PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00\x0E\x00\x00\x00\x0E\b\x06\x00\x00\x00\x1FH-\xD1\x00\x00\x00\tpHYs\x00\x00\x0B\x13\x00\x00\x0B\x13\x01\x00\x9A\x9C\x18\x00\x00\x01VIDAT(\xCF\xA5\x91\xB1j\xC2P\x14\x86\x93\xD6\x94\x98\xA4\xB5\xA5\x85\x0E-R\xAF\xA5\xB8\xF4\x1D\xAA\xEF\x10_B\x9C\xDD\x0B]\xA4o`C\xE9$B\x1C\xCD\x10\x10C6\x05q\td\xA9%\x83d2\x83O\xF0\xF7\xDCp#i\xB5\x1D\xDA\xC0\xC7\xB97\xE7|\xF7\xDC\xCB\x91\x00H\x7FA\xFA\xB7\x98\xFF\xAA\xD5\xEA\x0B\x855\xC1\x13k\xDA\xBF\xEA\x9A\xA6\x9C\x18\xC6\xC1\xB6\xE8\xBBHE\x16\x85w\xC6\xD8\xE3\x91\xA2\xDCQ|\xA2\xFD\x07\xC57\xADXT\x8B\xAAz\xB8#\x8A\x13\xD7\xBC\xD8\xD0\xB4kC\xD7\x19q\xCB*\x95g\xFA\x9FP\xD7\x0B\x8A\n!oE.\xB5Z-\xEC\xA3\xD9l\xA2\xFEP\x07\x1D\xC8;\x18D!/\x16x\x91\xEF\xFBX.\x97\xD8l6H\x92$]O\xA7S\x8CF#\x887\x9F\x13j^T\xB9\xD8\xE9t0\x99L\x10\xC71V\xAB\x15\x82 \xC0\xD0\x1E\xA2\xDDng\xE2\x15q\x9C\x175.:\x8E\x83\xC5b\x81(\x8A \xCB2\xE6\xF39\\\u00D7E\xBF\xDF\xCF\xC4\x1B\xE24/\x1A\\\u00ECv\xBB\xF0<\x0Fa\x18\xA2\xD1h`<\x1E\xC3\xB2,\x98\xA6\x99\x89\x8C8\xDB\x11\x07\x83AzU\xDEu6\x9B\xA5\xA2m\xDB\xE8\xF5z?\x8B4\xC3,\xF9\x1B_E1\x9F\x12Q&j\xC4\xFD\x1Ej\"_\xCA\x8B\x051\xA3K\x91d{(\x8B\xBC\xFE\t\xC1TI!\xE3L\x03\x7F\x00\x00\x00\x00IEND\xAEB`\x82",
            pngNop = "\x89PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00\x0E\x00\x00\x00\x0E\b\x03\x00\x00\x00(\x96\xDD\xE3\x00\x00\x00\x03PLTE\x00\x00\x00\xA7z=\xDA\x00\x00\x00\x01tRNS\x00@\xE6\xD8f\x00\x00\x00\x15IDATx\xDA\xDD\xC1\x01\x01\x00\x00\x00\x80\x90\xFE\xAF\xF6#\xDA\x01\x00\xD2\x00\x01\xCC \x10\x14\x00\x00\x00\x00IEND\xAEB`\x82",
            w = new Window('dialog', " ExtendScript Memory"),
            p1 = w.add('panel', u, "References"),
            lRefs = p1.add('listbox', u, "",
                numberOfColumns: 4,
                showHeaders: true,
                columnTitles: ["Address", "Type", "Name", "Refs"],
                columnWidths: [90,60,120,36],
            g = w.add('group'),
            pFrom = g.add('panel', u, "From"),
            lFrom = pFrom.add('listbox', u, "",
                numberOfColumns: 4,
                showHeaders: true,
                columnTitles: ["Address", "Type", "Name", "Property"],
                columnWidths: [90,60,120, 120],
            pTo = g.add('panel', u, "To"),
            lTo = pTo.add('listbox', u, "",
                numberOfColumns: 4,
                showHeaders: true,
                columnTitles: ["Property", "Address", "Type", "Name"],
                columnWidths: [120,90,60, 120],
        g.orientation = 'column';
        w.orientation = 'row';
        w.alignChildren = ['left','top'];
        lRefs.maximumSize = lRefs.minimumSize = [330,450];
        lFrom.maximumSize = lFrom.minimumSize = [420,120];
        lTo.maximumSize = lTo.minimumSize = [420,220];
        lRefs.onChange = function()
            lFrom.removeAll();
            lTo.removeAll();
            lFrom.parent.text = "From";
            lTo.parent.text = "To";
            if( !this.selection ) return;
            var key = '&'+this.selection.text,
                t = o[key],
                from = t.from,
                i = from.length,
                k;
            lFrom.parent.text = "["+key.substr(1)+"] is reachable from " + t.ppCount + (1<t.ppCount ? " properties" : " property");
            if( t.ppCount && !i )
                with( lFrom.add('item', '--------') )
                    image = pngNop;
                    subItems[0].text = '';
                    subItems[1].text = '<UNKNOWN REFERRER>';
                    subItems[2].text = '';
            while( i-- )
                k = from[i][0];
                t = o[k];
                with( lFrom.add('item', k.substr(1)) )
                    image = t.locked ? pngLock : pngNop;
                    subItems[0].text = t.type;
                    subItems[1].text = t.name + ' ' + t.tag;
                    subItems[2].text = from[i][1];
            for( k in o )
                if( !o.hasOwnProperty(k) ) continue;
                t = o[k];
                from = o[k].from;
                i = from.length;
                while( i-- )
                    if( from[i][0]!=key ) continue;
                    with( lTo.add('item', from[i][1]) )
                        image = pngNop;
                        subItems[0].text = k.substr(1);
                        subItems[1].text = t.type;
                        subItems[2].text = t.name + ' ' + t.tag;
            lTo.parent.text = "["+key.substr(1)+"]'s properties had access to " + lTo.items.length + " addr.";
            from = t = null;
        for( i=0, n=a.length ; i < n ; ++i )
            t = o[k=a[i]];
            with( lRefs.add('item', k.substr(1)) )
                image = t.locked ? pngLock : pngNop;
                subItems[0].text = t.type;
                subItems[1].text = t.name + ' ' + t.tag;
                subItems[2].text = t.ppCount + '/' + t.rfCount;
        w.show ();
    // TEST
    var t;
    var f = function MyFunc()
        (function MyInnerFunc(){})();
    $.scanRefs(1);
    @+
    Marc

  • Linking Equipments to all the classes and characteristics

    Hello Everyone,
    I need a list of all the equipments for a specific technical object type in a given plant with their classes ,characteristics and values.
    I tried to do it with standard list editing IH08, but it restricts me to max of 20 characteristics.
    Can some one help me with an alternative or a query to pull up all the classification info ( classes, characteristics, and characteristic values)
    Thanks in advance
    Sumit

    Hi,
    The work around I am using to overcome this problem is Unzipping th ear/war file created by servicegen task and including all the classes. Then creating the ear file again by creating a new ant target.
    I know this is not a neater way, but this works for me.

  • Collection available to all the classes

    Hello,
    I am just wondering if I can have a collection of an object and that collection is made available to all the classes rather than creating that collection again and again. For example I am deserializing an object from the file in one of the class, how can I make that object available to all the classes, I don’t want to read it again and again. This can be done easily when using java servlet, but my application is standalone, so is there any way of achieving this?
    Any idea will be appreciated.
    Many Thanks,

    JoachimSauer wrote:
    veer2go wrote:
    Yeah Thanks mate, do u think, this approach is better or passing the collection through the parameters is better?That question is opening a huge can of worms.
    Normally I'd say avoid the static version as much as possible. Pass the Set to all objects that need it.
    This could lead to the Set being passed through many levels of calls, 'though. This usually means that your classes are not isolated enough and need to be refactored.
    So both solutions can become quite ugly and writing a clean one takes some experience.+1
    The assumption that all classes need to see this collection is to be challenged. It's usually made in order to avoid working out exactly what needs the object in question

  • How to load all the classes in a JAR file at runtime?

    Any clues o:
    "How can I force JVM to load all the classes in a specified JAR at once?"
    Thanx!
    -Rajeev

    Well I was thinking may be there exists an option with "java", when I
    am starting an application from a jar file, I could force it to load all
    the classes in the JAR. I don't want to do it programically. Is there such
    an option available?? Or in other words can I ask JVM to not do the dynamic
    loading for the JAR??
    Thanx.
    List all JarEntries and convert the paths to fully
    qualified class files
    e.g file in jar
    [1] /com/mycompany/proj/X.class
    should become
    [2] com.mycompany.proj.X
    then for each entry issue
    Class.forName( [2] );

  • Is it possible to get a count of all the class files in a Flash Builder project?

    Is it possible to get a count of all the class files in a Flash Builder project?
    Thanks!

    Resultsets are one per connection unless you have copied them. Do you have lots of connections are you properly reusing them or at least closing and discarding all references?
    See tutorial and Javadoc of API too

  • Is Active Directory's ExtensionAttributes9 a field in user object and how to retrieve it in the class type userprincipal?

    Hi, I'm using VS2012.
    I want to use this ExtensionAttributes9 field to store date value for each user object.  I use UserPrincipal class, a collection of these objects are then bind to a gridview control.  Is ExtensionAttributes9 a field in AD user object? 
    How can I access it and bind to the gridview?
    If this field isn't available then what other field can use?
    Thank you.
    Thank you

    UserPrincipal is basically a wrapper around DirectoryEntry:
    http://msdn.microsoft.com/en-us/library/system.directoryservices.directoryentry.aspx and only provides a subset of the Active Directory, although the most common, attributes that are available for the user object.  The attribute that you
    seek is not one of them.
    By utilizing the method that I provided you a link to, it will return the underlying DirectoryEntry that was used to build the UserPrincipal object and should allow you to access the attribute that you seek.
    It would be greatly appreciated if you would mark any helpful entries as helpful and if the entry answers your question, please mark it with the Answer link.

  • Calling a Classes constrictor explicitly with out editing the Class

    Hi All,
    I am looking for a way to call the a Classes static constructor of a class so that the static fields get initialized. Here is some pseudo code to illustrate
    class Singleton {
        private static instance = new Singleton();
        private Map map = new HashMap();
        boolean obtainedKey = false;
        private Singleton() {
            //populate map code
        public Singleton getInstance() {
            return instance;
       public Object getVal(String key) {
           obtainedKey = true;
           return map.get(key);
      public getObtainedKey() {
         return obtainedKey;
    class MyClass {
         static Singleton sing = Singleton.getInstance();
         static Object objVal = sing getVal.get("key");
    public static void main(String [] args)  {
          Singleton singMain = Singleton.getInstance();
          MyClass.*SOME_METHOD_ALREADY_IN_JAVA*;
          assert(singMain.getObtainedKey() == true);
    } One solution is to add a method ;
    static void init() {}; to the class MyClass and then to call this method,
    However I would like to find a method somewhere in the java library so I don't have to write a init method.

    I think you really should re-think your architecture if it depends on such strange loops (and personally I've had very bad experiences with static initializer blocks, especially those that can fail).
    But curiousity got the better of me and I dug into the JVM spec. In �2.11 (http://java.sun.com/docs/books/jvms/second_edition/html/Concepts.doc.html#32316) it says
    Any static initializers declared in a class are executed when the class is initialized (�2.17.4) and, together with any field initializers (�2.9.2) for class variables, may be used to initialize the class variables of the class (�2.17.4).And in �2.17.4 (http://java.sun.com/docs/books/jvms/second_edition/html/Concepts.doc.html#19075) it says
    Initialization of a class consists of executing its static initializers (�2.11) and the initializers for static fields (�2.9.2) declared in the class. Initialization of an interface consists of executing the initializers for fields declared in the interface (�2.13.3.1).
    Before a class or interface is initialized, its direct superclass must be initialized, but interfaces implemented by the class need not be initialized. Similarly, the superinterfaces of an interface need not be initialized before the interface is initialized.
    A class or interface type T will be initialized immediately before one of the following occurs:
    * T is a class and an instance of T is created.
    * T is a class and a static method of T is invoked.
    * A nonconstant static field of T is used or assigned. A constant field is one that is (explicitly or implicitly) both final and static, and that is initialized with the value of a compile-time >constant expression. A reference to such a field must be resolved at compile time to a copy of the compile-time constant value, so uses of such a field never cause initialization.
    Invocation of certain methods in library classes (�3.12) also causes class or interface initialization. See the Java 2 platform's class library specifications (for example, class Class and package java.lang.reflect) for details.So if you don't want to create and instance or add a method then you can only use (read) or assign a nonconstant static field (the field initialized by the static block should be fine).
    The library functions above are not required to initialize the class, so that won't be much help.

  • Iterate through List and return (the names) of all the classes

    Hi,
    I've got a List and want to see what kind of classes are in this List.
    List list = getList();
    Iterator it = list.iterator();
    while (it.hasNext()) {
         Object ob = it.next(); // get the next item. Is this the right approach for my problem?
            // Her I want to check the Object what classses it holds,
            // assuming that this is the right approach for my problem
    }Thanks
    Jonny

    Hi,
    that's what I did:
    List list = getList();
    Iterator it = list.iterator();
    while (it.hasNext()) {
         Object ob = it.next(); // get the next item. Is this the right approach for my problem?
             Class cLass = ob.getClass();
             System.out.println("\t" + cLass.getName());
    }This returned java.lang.Object as mentioned.
    Question:
    - Can an Object hold several types of classes? If so, how can I iterate them?
    Mabe this makes things a little clearer:
    Why am asking this? I'm returning a List from a (Hibernate)-query. I can access one Class without problems. Another class that should be returned, I can't access. Thats why I want to know what I'm dealing with.
    Thanks
    Jonny

  • How to access all the classes in a jar file

    hai
    i have a custom built JAR file which has many classes(Translets) in it . i want to access the classes inthe JAR file in a JSP page or an servlet. I have tried setting the classpaths etc , but nothing has happened.
    Where should the jar file be Palced - i am using Tomcat Server.
    How Can i Access the class files .. Very Urgent .. Please Help me ..
    Peter Iyer

    What is showing a file not found error? The web browser? if so, that's probably not a problem with the jar file.
    Also, have you expanded your jar file to make sure that you jarred it up correctly?

  • "The class being compiled does not match the class that was imported"

    ----------Actions on timeline in
    sixSpices/updateSite/updateSite.fla----------
    import com.sixspices.updater.view.*;
    var calDrawer:CalendarView = new CalendarView(); //Listener /
    view
    ----------sixSpices/com/sixspices/updater/view/CalendarView.as
    file----------
    class CalendarView {
    public function CalendarView(){
    public function onRecieveData(listOfEvents:Array) {
    displayEvents(listOfEvents);
    public function displayEvents(listOfEvents:Array):Void {
    trace(listOfEvents);
    When I test the movie (updateSite.swf) in flash, it gives me
    the error:
    The class being compiled, 'CalendarView', does not match the
    class that was imported,
    'com.sixspices.updater.view.CalendarView'.

    Here is my file structure:
    sixSpices
    -->updateSite
    -->-->updateSite.fla
    -->-->updateSite.swf
    -->com
    -->-->sixSpices
    -->-->-->updater
    -->-->-->-->view
    -->-->-->-->-->Calendar.as
    If I move updateSite.fla to the folder sixSpices so that
    "com" is in the same folder as it, I get the same error.
    The following works with no problems (no similar error):
    ----------Actions on timeline in
    sixSpices/updateSite/updateSite.fla----------
    import com.sixspices.updater.model.*;
    var calModel:CalendarOverview = new CalendarOverview();
    //Broadcaster / model
    ----------sixSpices/com/sixspices/updater/model/CalendarOverview.as
    file----------
    import com.sixspices.updater.model.*;
    import mx.utils.Delegate;
    import mx.events.EventDispatcher;
    class CalendarOverview {
    public function CalendarOverview(){
    }

  • Business Content object type Infocube does not show all the BIcontent cube?

    Hi Guru's
    SAP ECC 6
    When i go to BI Content-> Object Types-> InfoCube shows only following cubes
    0BWTCFC1
    0BWTCFC2
    0RSTT_C01
    0RSTT_C02
    0RSTT_C03
    0RSTT_C04
    0RSTT_C05
    0TCA_HIE
    0TCA_UA
    0TCA_VAL
    9AII_C01
    I want to know why all the cubes of BI content not displayed.

    Hi,
    Shown Infocubes might be activared already or viewed BI content.
    If u want to see more Info Cubes(BI Content), select Select Objects(Plant with three branches symbol).
    Regards,
    Ram

  • Tomcat 4.1 class problem. Doesn't identify the class.

    Hi
    I just installed J2SDK and tomcat in windows xp. I've made jsp files and beans. The first page is customerlogin.jsp which takes user id and password in a form. It sends the request to authenticate.jsp. Would you please give me a few important steps that need to be done?
    My directory structure is as follows:
    C:\Tomcat 4.1\Webapps\Log -> jsps
    c:\Tomcat 4.1\Webapps\Log\WEB-INF\classes\Log -> java beans
    The jsp doesn't find AuthenBean class. It complains about it.
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 1 in the jsp file: /authenticate.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    C:\Tomcat 4.1\work\Standalone\localhost\Log\authenticate_jsp.java:43: package Log does not exist
    Log.AuthenBean Authen = null;
    ^
    ******** AuthenBean is : *********
    package Log;
    public class AuthenBean{
         String userid;
         String password;
         public void setUserid (String tuserid) {
                   userid = tuserid;
         public void setPassword (String tpassword) {
                   password = tpassword;
         public String getUserid() { return userid; }
         public String getPassword() { return password; }
    ******** Authenticate.jsp ***********
    <jsp:useBean id="Authen" class="Log.AuthenBean" scope="session"/>
    <jsp:useBean id="select" class="Log.ExecuteQuery"/>
    <jsp:setProperty name="Authen" property="*"/>
    <%
    String id = Authen.getUserid();
    String passwd = Authen.getPassword();
    out.print("User id is " + id);
    out.print("Password is " + passwd);
    %>
    <%@ page import="java.util.Vector" %>
    <% Vector aResult = select.getResult();
    select.connect();
    boolean idCheck = false;
    String query = new String();
    query = "SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME, PASSWORD, COUNTY, AREA FROM EMPLOYEE, LOCATION WHERE EMPLOYEE_ID = '" + id + "' AND PASSWORD = '" + passwd + "' AND (EMPLOYEE.LOCATION_ID = LOCATION.LOCATION_ID)";
    select.select(query, 6);
    select.disconn();
    int size = aResult.size();
    if(size > 0){
    idCheck = true;
    if(idCheck)
         session.setAttribute("loginId",id);
         session.setAttribute("firstName",(String)aResult.elementAt(1));
         session.setAttribute("lastName",(String)aResult.elementAt(2));
         session.setAttribute("county",(String)aResult.elementAt(4));
         session.setAttribute("area",(String)aResult.elementAt(5));
    %>
    <jsp:forward page="customer.jsp"/>
    <%
    else
    String error_msg = "Error: User Authentication Failed!";
    String link = "customerlogin.jsp";
    session.setAttribute("prevPage", link);
    session.setAttribute("errorMsg", error_msg);
    }%>
    ****** web.xml in Log\WEB-INF is **********
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!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>Log\AuthenBean</servlet-name>
    <servlet-class>Log\AuthenBean</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>Log\ExecuteQuery</servlet-name>
    <servlet-class>Log\ExecuteQuery</servlet-class>
    </servlet>
    </web-app>
    Your help would be appreciated
    Thanks!

    Your problem is in web.xml. Only servlet classes need to be mapped. Your bean class should not be.
    ****** web.xml in Log\WEB-INF is **********
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web
    Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <servlet>
    <servlet-name>Log\AuthenBean</servlet-name>
    <servlet-class>Log\AuthenBean</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>Log\ExecuteQuery</servlet-name>
    <servlet-class>Log\ExecuteQuery</servlet-class>
    </servlet>
    </web-app>
    If you have only jsps, u mau use
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web
    Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    </web-app>
    Hope it works.
    Hafizur Rahman
    SCJP

  • JSP Accessing variables in a class that are located outside of the class

    I am having a problem accessing a nested HashMap in a function. The HashMap is defined before the HTML starts and the function is located near the end (Shouldn't make a difference).
    List tires = databean.getTires();
    Map frontTireInfo = (Map)tires.get(0); //Works
    Map rearTireInfo = (Map)tires.get(tires.size()-1); //Works
    Map neumaticos = new HashMap();
    for(Iterator itr=tires.iterator();itr.hasNext();) {
         HashMap tempTire = (HashMap)itr.next();
         String tirePosition = (String)tempTire.get("position");
         neumaticos.put(tirePosition, tempTire);
    <HEAD>. . . </HEAD>
    <BODY>. .
    <%=getTireInspectionTable("FRONT_RIGHT")%> //Works
    </BODY>
    I believe the above stores the tempHash in the tirePosition.
    <%!
         private String getTireInspectionTable(String tirePos) {
              StringBuffer sb = new StringBuffer();
         sb.append("<input type='text' value=" +
    *****<% neumaticos.get(tirePos) %> + " />" ) illegal start of expression
    return sb.toString();
    %>
    Why can I not access neumaticos in the method?
    I am able to call other methods from this one, but not variables.
    If it is possible, please help point me in the correct direction.
    Thanks in advance,
    Mike

    MPDreiding wrote:
         sb.append("<input type='text' value=" +
    *****<% neumaticos.get(tirePos) %> + " />" ) illegal start of expression
              Illegal start of expression sounds like a compile time error so your syntax is wrong. Why are you using scriptlet
    <% neumaticos.get(tirePos) %>
    inside of declaration? I think that's the problem. Just remove <% and %> and see what happens.

Maybe you are looking for