Pages

Sunday, January 20, 2008

Java Server Pages with CDK functionality

Setting up interactive web pages can be done in many way. Java Server Pages are just one of them. They are quite similar to PHP pages or Ruby, and combine plain HTML (and likely any other output) code with fragments of code; Java source code in this case.

Ubuntu's tomcat5.5 package installs quite easily, and sets up a server at port 8180. I still have to figure out how to nicely integrate it with the Apache server on port 80, though. Suggestions much appreciated.

From then on, one can add new JSP pages by creating a 'webapp' in /usr/share/tomcat5.5-webapps. The basic structure looks like:

Just copying the large CDK jar (the one with all the third party libraries) into WEB-INF/lib/ did not work for me, but unjaring it into WEB-INF/classes/ seem to work fine.

Then, you can just add Java code using the CDK library for what ever you like. The following (simple) example JSP page, takes one parameter, a molecular formula. This could be the input given in a FORM, but the below page does not deal with that situation yet:

Now, a lot of improvement can be achieved. For example, the <head> stuff can be split out in a header.include. And, after proper integration with the Apache server, rewrites could be used to create a REST service. But, the above is just to give you an idea.

In case you wonder, this work is related to the opensource MetWare database software development our group is involved in.

J2EE servers consist of two parts, EJB container and Web Container. EJB containers provide a runtime environment to the Enterprise Java Bean components holding the business logic, while the web containers hold the presentation logic in the form of servlets and Java server pages.

Search This Blog

This blog deals with chemblaics in the broader sense. Chemblaics (pronounced chem-bla-ics) is the science that uses computers to solve problems in chemistry, biochemistry and related fields. The big difference between chemblaics and areas such as chem(o)?informatics, chemometrics, computational chemistry, etc, is that chemblaics only uses open source software, open data, and open standards, making experimental results reproducible and validatable. And this is a big difference!

Cookies

In the EU there is a directive upcoming requiring websites to warn people about HTTP cookies. This website uses the Blogger.com platform, Google Adsense (not that is it actually paying anything significantly), and a few scripts to count how often a blog post was tweeted, using Topsy and LinkedIn. These services undoubtedly make use of cookies, which you can disallow in your browser.