This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp stuck at compiling port listening program.

 
vincentfasf tan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am developing a web SNMP manager using JSP/Servlet. In the application, i have a java class which needs to keep on listening to a port after being call by JSP. Problem is because the java class must keep on listening to a port which mean the JSP will keep on compiling without end. Even after the java class stops, the JSP still continue to wait or worst, the java class won't be executed again when the JSP is run again because JSP only compiles the first time it runs. Is there any way to do this?

Only solution i can think of is after executing the java class through jsp, i let the java class to write any reply into database. Then i retrieve the data from database using another JSP/servlet. Still the jsp that first calls the java class still stuck there waiting for localhost.
 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
PLEASE CAN THIS THREAD BE MOVED FROM JSP

The java class that is listening, (for ever?). i think it needs to spawn (sorry if that is old C terminology) a thread that will do the listening, so that the servlet doesn't hang.
The resultas from this thread need to be put somewhere, maybe a database.

now in the page that wants the results I would have a javascript or ajax item that has a clock and checks the database every now and then to update whatever you want to know about.
 
Andrew Moko
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. You need an "ajax-push-server" technology to dynamically push data from server-client.

http://en.wikipedia.org/wiki/Comet_%28programming%29
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic