aspose file tools*
The moose likes Beginning Java and the fly likes non compiling drop down list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "non compiling drop down list" Watch "non compiling drop down list" New topic
Author

non compiling drop down list

Chris Davies
Ranch Hand

Joined: Feb 26, 2003
Posts: 110
hi
the following code wont compile (LegalListBean is from a custom api which pulls the legal values attached to tabel in dbase) -



its giving me the following errors




getParameterNames is a method of the LegalListBean which uses the following constructor -

LegalListBean()
Constructor.

in terms of the basiswebtop package, here is the following values set in my environment variable settings



finally here is the inheritance structure of LegalListbean from the webtop api



are the other errors following on from not finding the package ?

cheers

chris


One day all greenhorns will run free ...
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24185
    
  34

Well, looks like we've solved one mystery for you. This import statement:

import basiswebtop.*;

is failing because the package of interest here is actually called "com.opentext.basis.webtop.beans". It looks like you though that the import statement could take the name of the jar file, but this isn't right; import's argument is always a package name. The class LegalListBean is in the package com.opentext.basis.webtop.beans, so you need to write

import com.opentext.basis.webtop.beans.*;

The star means "all the classes in this package." Now, on the other hand, you want to use the class StringTokenizer, but you've written

import java.util.StringTokenizer.*;

which implies that StringTokenizer is a package, and you want the classes in that package; but that's wrong -- you want the class StringTokenizer itself, so you want to say

import java.util.StringTokenizer;

Making these two changes will get you past all the errors shown here.


[Jess in Action][AskingGoodQuestions]
Chris Davies
Ranch Hand

Joined: Feb 26, 2003
Posts: 110
thanks.

i've got this final error



the api lists the following for the method



i tried using the set data type before the lists variable but the compiler didn't like that either.

cheers

chris
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24185
    
  34

The error message



means that (first line) on line 19 of file list.java (second line) you're using a variable named "lists" which is undefined, and (third line) this happens while compiling the class "list".

Now, looking at your code up above, I see you using the variable "lists" (actually in your first code sample it was called "list") but I don't see where you've declared it anywhere. Java variables always must be declared before use (or while being initialized.)
Chris Davies
Ranch Hand

Joined: Feb 26, 2003
Posts: 110
i'm declaring the variable as a set in the following code as that is what it says the method takes in the javadoc api






if i declare the variable lists as a String type then i get the following -




I can't find info relating to the Set data type (its not a primitive is it ?)

also can i assign this Set data type to a String ? i was doing so so that it could be immutable - would it be ok to declare the input variable as a set ?

cheers

chris
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
what is the return type of getParameterNames ? Is it really a Set ?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24185
    
  34

Chris,

I already explained rather carefully how to read these error messages. Now let's look at this latest one:



It says that in the line "Set lists;", it has no idea what a "Set" is. That's because you didn't import java.util.Set.
Chris Davies
Ranch Hand

Joined: Feb 26, 2003
Posts: 110
thanks thats compiled

though i have a couple of questions -




in terms of the code above the 'cannot resolve symbol' seems to happen in a number of different error messages - or are they always particular to 'class import' messages ?

in the following section of the code does "list" require the commas as its refernce a variable and is not a data value ?



finally

when i'm instantiating this class - (i'm going to attach it to jar file of existing classes) i'm going to omit the main method (as the app already has one), is it sufficient to just intantiate it like the following

list ls = new list()

whta i'm trying to say is does this class need methods in order to make it useful ? i wish to put it in a jsp page.

cheers

chris
 
Don't get me started about those stupid light bulbs.
 
subject: non compiling drop down list