| Author |
Question about queue~
|
t tea
Greenhorn
Joined: Mar 03, 2003
Posts: 10
|
|
i am testing the queue and push in jsp, but there is error : "Unable to compile class for JSP cannot resolve symbol symbol : class Queue " code: <%@ page import="javax.util.*" %> <% Queue queue = new Queue(); String location[]= new String[3]; location[0]="0"; location[1]="9"; location[2]="0"; location[3]="8"; for(int j=0;j<4;j++) { if(location[j] !="0") queue.push(location[j]); } while ( !queue.isEmpty() ) System.out.println( queue.pop() ); %> What's wrong with that?
|
 |
Irene Loos
Ranch Hand
Joined: Apr 15, 2002
Posts: 75
|
|
|
Make sure that your "Queue" class located in the imported package.
|
Irene Loos
|
 |
t tea
Greenhorn
Joined: Mar 03, 2003
Posts: 10
|
|
sorry, i am really not sure as i am just beginner. How to do that?
|
 |
Irene Loos
Ranch Hand
Joined: Apr 15, 2002
Posts: 75
|
|
I am not familiar with "Queue" but I searched J2EE API J2EE API and found it located in javax.jms package. You will need to add import statement for this package to ypur JSP in order to have an access to the "Queue" class: [ March 03, 2003: Message edited by: Irene Loos ]
|
 |
t tea
Greenhorn
Joined: Mar 03, 2003
Posts: 10
|
|
Thanks~ I imported the statment and one more error : package javax.jms does not exist how can i get the package?
|
 |
t tea
Greenhorn
Joined: Mar 03, 2003
Posts: 10
|
|
that Queue seems not the one I am using !? I search and find it is in : java.lang.Object | +--java.util.AbstractCollection | +--java.util.AbstractList | +--java.util.Vector | +--org.mancer.tools.Queue then i tried, but still cannot compile the class
|
 |
Irene Loos
Ranch Hand
Joined: Apr 15, 2002
Posts: 75
|
|
Like I told you, I am not familiar with queue but if you need to use some collection classes why not to use something like that (of cause I do not know what are you trying to achieve): Plus your code has a bug: Your array will be out of bound since you specified 3 elements as a size and trying to use 4th element. [ March 03, 2003: Message edited by: Irene Loos ]
|
 |
t tea
Greenhorn
Joined: Mar 03, 2003
Posts: 10
|
|
Thanks! ic, i just think stack and queue are similar things, as i prefer FIFO and use queue. Acually, what i want to do is throwing out a specific value in the array, like myarray={4,0,0,8}, I want it to become array={4,8}. I try once the above code, but nothing out. I will keep trying also.
|
 |
t tea
Greenhorn
Joined: Mar 03, 2003
Posts: 10
|
|
Thanks. I am display the result by stack, but now i am trying to reverse the order and put in the string array.
|
 |
 |
|
|
subject: Question about queue~
|
|
|