saoj
Joined: 10/01/2008 08:20:15
Messages: 39
Offline
|
Because Scala code is compiled into Java bytecode, you can code your web application using Scala instead of Java.
Below is an example of a Mentawai action coded in Scala:
Compile this Scala class with the following command line:
This will create a file HelloScala.class inside the org\mentablank\action directory. Now you can use this class as any other Java class. Just remember to put the scala-library.jar inside the your WEB-INF/lib directory.
Let's use the javap program, that comes with Scala, to inspect our Scala class from the point-of-view of a Java program:
This will give you some hints about the Java class, but nothing can be better than a decompilation using JAD (Java Decompiler):
Enjoy using Scala with Mentawai!
Some Scala resources:
http://www.codecommit.com/blog/scala/scala-for-java-refugees-part-1
http://alblue.blogspot.com/2007/10/scala-introduction-to-scala-interpreter.html
http://www.ibm.com/developerworks/java/library/j-scala01228.html
|