JavaOne 2008 Session Examples
Thursday 22 May 2008 | Jim Crossley in
General
I have put together the Java code and HTML pages for the examples that I used in the JavaOne Technical Session "Is there a place for applets in Web 2.0?" that Gary and I presented a few weeks ago.
The examples are available from http://developers.altio.com/developer/downloads/JavaOneApplets-TS5453.zip
Most of them are self-explanatory. All of the source is in the exampleapplets.jar file - the code for the applets is under the com.altio.examples.applets package, and each class is named for the Example it relates to (e.g. Example1.class). You can run Examples 1-3 by placing the JAR file in the same folder as the HTML files and opening the HTML files directly.
Example 4 requires that the files are deployed onto an application server, such as Tomcat, as it requires a servlet to connect to. The servlet code is also in the exampleapplets.jar under com.altio.examples.servlets. To deploy this servlet simple copy the JAR into the classpath for your application server (e.g. TOMCAT\webapps\some web app\WEB-INF\lib) and then set up the necessary web.xml changes to install the Servlet. On Tomcat this means:
Add a <servlet> entry:
<!-- JavaOne -->
<servlet>
<servlet-name>ServletExample</servlet-name>
<servlet-class>com.altio.examples.servlets.DataServlet</servlet-class>
</servlet>
and a <servlet-mapping>
<!-- JavaOne -->
<servlet-mapping>
<servlet-name>ServletExample</servlet-name>
<url-pattern>/servlet/com.altio.examples.servlets.DataServlet</url-pattern>
</servlet-mapping>
Please consult your application server documentation for details on how to install servlets though.
I hope you find the examples useful. As a bonus I've included an Example4a.html, which uses the same applet as Example4, but uses a JNLP file to deploy the applet and enables the new functionality to drag the applet outside of the browser as demonstrated at JavaOne. You will need to be running the very latest Java 6 Update 10 browser plugin for this to work. This can be downloaded from http://java.sun.com/javase/downloads/ea/6u10/6u10beta.jsp