• Post Reply Bookmark Topic Watch Topic
  • New Topic

Question about queue~  RSS feed

 
t tea
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure that your "Queue" class located in the imported package.
 
t tea
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry, i am really not sure as i am just beginner.
How to do that?
 
Irene Loos
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks~
I imported the statment and one more error : package javax.jms does not exist
how can i get the package?
 
t tea
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I am display the result by stack,
but now i am trying to reverse the order and put in the string array.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!