In this article we installed Tomcat so that we could serve JavaServer Pages (JSP). JSP is pretty easy to start off with, since you merely add the script parts to regular HTML, much like PHP. For instance, we could call this HTML hellow.jsp:
<html> <body> Hello </body> </html> |
If we browse to our JSP server, we get:
Let’s use a little JSP. The JSP stuff lives between <%= and %>. Here is some code:
<html> <body> Hello, my name is <i> <%= System.getProperty("os.name")%> <%= System.getProperty("os.arch")%> <%= System.getProperty("os.version")%> </i> <br /> <br /> I live at <b><%= System.getProperty("java.home")%></b> </body> </html> |
For more information on System.getProperty, see this page. We put this in /opt/tomcat/webapps/ROOT. When we browse to this page, we see:
Note that this stuff is compiled on the fly using javac. This means that there is a very sophisticated language available to control your web applications. While we are on the whole Java deal, what language besides Java can be used to create web apps, yet can also be used to program a microcontroller natively?