Nikolaos Plastiras

Greenhorn
+ Follow
since Feb 08, 2012
Nikolaos likes ...
Firefox Browser Java Windows
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nikolaos Plastiras

Welcome Scott Selikoff & Jeanne Boyarsky !!!
Below is some code.
handleConnection is called when a new serverSocket.accept() gets a request.
run is the code the thread that handles input from clients runs.
Because of readLine() (I think) thread waits and doesn't read other client's input.
I am trying to find a way to read the input (a simple string) of multiple clients using one thread (besides main thread) only on the server side.

Thought something like when clientSocket = serverSocket.accept() happens, the socket would be added into a collection and then a single thread (instead of starting a new thread per client to listen) could read the sockets' collection and then read the input of each socket in an endless while loop.

I have problem cycling through the collection since main thread adds an element in the collection while another thread tries to cycle throught. Can't "see" second client while iterating.

Have already tried ArrayList and CopyOnWriteArrayList (java.util.concurrent.*)

Any suggestions?

Paul Clapham wrote:I just compiled it and ran it (in Eclipse) and it completed successfully. And I don't see the PingPong$1.class in the compiled classes folder with the other two.

By the way Java 7 is my default runtime. Perhaps this is significant?


I did that too and got two files in bin folder. But did a classic (1.6) javac compilation and got three files!
When I compile this code it outputs PingPong.class , PingPong$MyThread.class and PingPong$1.class
The first and second I understand, but I don't understand why it outputs PingPong$1.class since there is no anonymous inner class. Or is there?..
This is the PingPong.java file:

I am trying to find the static values() method that is used to iterate through enums in J2SE 6 documentation but I can't find it.
Is this the correct class?
public abstract class Enum<E extends Enum<E>> extends Object implements Comparable<E>, Serializable
9 years ago
OH MY GOD, i spent 3 hours reading every others' problems, documentations about tomcat, jsp, jstl and jdk just because i was too tired at 4am to check for the most stupidest errors. I feel so embarrassed... Thanks for the help. Next time, i'll get a good night sleep.
10 years ago
JSP
Firstly, hello to everybody since this is my first post.

I am trying to run the Head First Servlets and JSP chapter's 3 beer example like so many others in here.
I have done every step successfully till the time i had to run a .jsp for the first time.
The result.jsp code is:

but when i try to run it i get this from tomcat (and some other stuff):


I read all the topics about others having problem with this exercise and none had a similar one.
If i change the result.jsp file to this:

everything runs smoothly and the message i printed properly.

for the record, the class with the setAttribute method is this:

Is there a problem with request.setAttribute("styles", result) in the .class file; ? If there was one, why tomcat sais the problem is in the Iterator it = styles.iterator();iterator line in the .jsp file?

Anyone got any ideas?
Thanks in advance.
10 years ago
JSP