Responsive Ad Area
Home » Blog » Java » Web Applications

Web Applications

Handling Keyboard Input and Mouse Events

Keyboard Input and Mouse Events In this example, I show you some simple input examples using Applets. Later I might add Web Start or even Swing Desktop examples. Here we get keyboard input (typing) as keyDown event. And we get mouse positions and clicks. We demonstrated mouse input as move, clicks and mouse drag and drop with a more complex example using a vector sprite stickman. See also Sound Effects and Music Keyboard Input Here I give you sample HTML needed. Put the source and HTML in the same folder and compile the source with 'javac KeyTest.java' Save this as 'keyboard.html' then run it at the console with 'appletviewer keyboard.html' . Note that you will have to give the window focus by clicking it, then when you press a key, output in the console will show which key was pressed. It...

Java Web Sockets

Java Web Sockets Java web sockets are Java's alternative to Ajax. It is actually not specifically Java but an open standard called Web Sockets which is the HTTP alternative to Ajax. Java Web Sockets is Java's implementation of Web Sockets. Basically, in HTTP and Common Gateway Interface (CGI) protocols there is much text-based overhead in each server request and response messages. Prior a hack was made to servers that were unofficial to get around this problem. They called it Ajax. It was made official with Web Sockets. Efficiency The jest of it is that now once the web socket is made your web page and Javascript code can make a very concise request with as few characters as possible from the server and get back a very concise response. This reduces bandwidth, speeds communications and red...

Facelets JSF: Java Facelets and Java Server Faces

Java Facelets and Java Server Faces So Java JSP is awesome and we need no more right? Wrong, JSP is great, but it is a very cryptic way to describe things. Routine work on web type applications developed into repetitive design and coding task. This was turned into what is called web frameworks. Jakarta Struts is a 3rd party API for such a framework. Sun felt it was time to create a framework for distribution with the standard and extended API. Facelets and Java Server Faces was born. Facelets and JSF are built on top of the existing servlet technology. A Facelet page is based on specialized Facelet codes which are "interpreted" by a Java Facelet servlet. Java Server Faces is the framework that uses this Facelet language. This gives the developer quick and easy access to common task using g...

Servlets JSP: Java Servlets and Java Server Pages

Java Servlets and Java Server Pages CGI Well first maybe I should explain a bit about the first actual web applications called CGI's. CGI(Common Gateway Interface) is a protocol or language for formatting request and responses from an HTTP server to an HTTP client. A client would be any web browser typically. Initially, a web server would send a request in CGI format to standard output on the server, at the same time calling a program on the server to startup. This program can be written in any programming language which can get standard input and output to standard output (practically any language, and even shell scripts). So the server sends the request to standard output which is read as standard input by the program. It then processes the request and prepares a response which is again ...

Applets Webstart: Java Applets and Webstart

Java Applets and Webstart Java Applets Java applets are mini-applications which run within another application. Applets actually could be run as a desktop application with Java's appletviewer.exe program. And actually, that may be the only way to make an applet run at the current day and time. Well, a better way to run an applet is to convert it to Web Start application which I talk about later on in this article. Applets lost popularity Java applets were quite the rage when Java first appeared on the scene. Applets are primarily run on a web page. However over time they lost popularity. Reasons for this might include applets being slow to startup. Another was applets not starting up at all which usually had a fix but was frustrating enough from the end user point of view to cause a loss i...