Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

University Registration System

 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
James and everyone else,
Perhaps you could help me solve a little problem I am having. I am designing a university registration system using Java (servlets & JSP, oracle). It is web-based, and because of this there's a slight problem. I need a way to refresh the page when the number of slots for a particular class changes. Otherwise, the number I am looking at on my screen will be off when someone at another terminal registers for that class. I know forced browser refreshes are impossible, but I was wondering if you guys had any bright ideas. I was thinking of having an applet for every "slots available number" and have that applet update itself when someone enlists (using RMI). Is this even possible? Any bright ideas?
Thanks for your help.
 
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The RMI route is possible, you need to use client side callback technique.
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, so I can make call-backs to applets. But wouldn't that look ugly and be heavy on memory? Let's say the user were looking at a page with 50 classes. That would be 50 applets connected to an RMI server. Is this really feasible? Or are there any other ideas?
 
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could make a light RemoteScripting-esque applet interface between DHTML and a Servlet. Is DHTML an option? How 'bout one simple applet included many times on the page with different paramaters for differnet classes that just connects to a servlet and gets fed up-to-date info.
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Garland,
That seems interesting. What do you mean by applet connecting to a servlet? I didn't know this was possible. How does this work?
 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An applet can connect to the server it was downloaded from with the normal socket API. Probably the easiest method and least likely to cause trouble (because of firewalls or sandbox rules) is to use http tunneling.
Basically, you can create an HttpServlet at your site (let's say it's at http://mysite.com/servlets/CourseFeeder) that doesn't actually serve web content. Instead, it just takes the output/input stream it's given an uses it to communicate with a client.
The client in this case would be an applet. It could create a URLConnection to http://mysite.com/servlets/CourseFeeder and use URLConnection.getOutput/InputStream() to establish a normal TCP connection (you may have to call URLConnection.setDoOutput(true) first).
At this point the server and client are connected via normal TCP sockets. The applet could send a line formatted something like this: "FOLLOW SCI 234". Then it could constantly wait for input and to the applet.
The server would first wait for a command (a class name to follow) and then print the class initial size or an error message ("BAD CLASS" or "OK 26"). Whenever the data gets updated, the server could print another line ("OK 27").
Too bad nio isn't standard yet. You'd want a way for applet to say something like "DONE" and have the server close its connection, but this would require threads (a servlet no-no I believe) or awkward timeouts.
 
Stanley Tan
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, thanks!!! I'll try that. Do you think there would be problems with let's say 50 of these small applets on a page? In your previous post you mentioned DHTML, where does this come in?
Thanks!
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic