Online Books:
java.net on MarkMail:
Search |
||
JSP on GrizzlyWebServerPosted by survivant on January 29, 2009 at 10:49 AM PST
We had a lot of people asking how to put JSP over Grizzly, but we didn't have an implementation or a working sample to show them.
It couldn't stay like that forever ... so I took a little of my spare time and I got something for you :) I'll show you how to compile your JSP with Jasper and use them with GrizzlyWebServer. I use Jasper that came with Tomcat 6. You will have to include some librairies to your project. I didn't try with Tomcat 4.x, but maybe you could save some space. I'll skip the jars required for Jasper to the end of this article. Now let's take a look at the beast (ok, mini-beast). The JSP page is really simple. If you want to use a framework like Struts, you will have more work to do, but I won't cover that.
We need to compile the JSP if we want to use it with our GrizzlyWebServer. It isn't really complicated.
This will generate the welcome_jsp.java and compile into /classes. Now we need to call it in our application.
The final touch is to test it. You will obtain a very nice output :)
http://localhost
I didn't go to deep into JSPC. I used JSPC, the class used by the Ant task. So because of that, we will needto include Ant jars into the project. If you have problems with that, I'm sure that you could extract the code from the ant task too. The jars needed are : ant-launcher.jar // from ant 1.7x ant.jar // from ant 1.7x el-api.jar // from Tomcat 6.x jasper-el.jar // from Tomcat 6.x jasper-jdt.jar // from Tomcat 6.x jasper.jar // from Tomcat 6.x jsp-api.jar // from Tomcat 6.x servlet-api.jar // from Tomcat 6.x tomcat-juli.jar // from Tomcat 6.x : for the logging into JSPC You can download the source code here. »
Related Topics >>
Open Source Comments
Comments are listed in date ascending order (oldest first)
Submitted by massimoh on Fri, 2009-01-30 10:44.
Thank you for posting this. This is extremely useful.
|
||
|
|