Domain: servlets.com
Stories and comments across the archive that link to servlets.com.
Comments · 19
-
Re:OpenGrok
while the above post was anonymous and probably not seen by many. it asked if there was a way to run this on a more local/lite deployment. i dont know myself, ive already got a tomcat box lying round for testing so it wasnt hard for me. But if you dont have a servlet container available. theres a few non tomcat options
http://servlets.com/engines/#embeddable has a list of quite a few. and from the list
http://jetty.mortbay.com/jetty/index.html seems to be the best candidate. (though it quotes no resource figures) -
Re:Could the editors...
Tomcat is many things:
- an open-source servlet container developed by the Apache Foundation
- the reference implementation for the Java servlet specification
- a container for JavaServer Pages
- a standalone web server
- an add-on for Apache and other web servers
The key is understanding what a servlet is. A servlet is an instance of a Java class that is invoked in response to an HTTP request. In other words, it's custom Java code for handling and responding to HTTP request by web browsers and other clients. Think the Java equivalent of CGI applications. If you like Java, servlets (and the JSP technology that is built on top of them -- JSP pages compile into servlets) are a nice way to build dynamic websites.
You can use Tomcat in standalone mode or by hooking it up to a web server like Apache -- it ships with a module for the latter that directs servlet requests from Apache to Tomcat and back.
It's getting easier to find hosting services that offer servlet support, and they usually run Tomcat to do it. Personally, I use KGB Internet, but check the list of servlet ISPs for other alternatives.
Eric
who has a Java-powered website -
Still looking for a book on modern approaches...
This book sounds pretty lame.
First, even the Struts developers themselves consider all but the struts:html tags to be obsoleted by the JSTL (lots of struts newsgroup posts to support this...no time to provide a link). JSTL provides not only a fairly rich set of "nuts and bolts" tags, but more importantly a set of base classes that can be easily extended for custom tags (such as the choose/when/otherwise construct and iterator tags). For Struts, the JSTL expression language has been encorporated into the struts-el tags, included in the latest 1.1 release. ...the caveat is that this approach requires J2EE 1.3 (Tomcat 4.0+, WebSphere 5.0+, Weblogic since forever-ago).
JSTL also obsoletes most of the Jakarta Taglib project's libraries, which frankly were very ugly from the start (separate tags for interacting with session/request/page objects? come on...check out the Expression Language that applies elegance to this problem, and is used in JavaServer Faces, JSTL, Struts-el, and everything useful from here on out).
As for templating engines, the biggest driver towards them has been the lame scriptlet-laden way JSP has historically been used (see The Problem with JSP). JSTL, Struts-el and before long JS Faces nail this problem, and IDE integration in the next year will make clear the reason why Template engines like Velocity aren't compelling (my opinion...not trying to offend). -
Re:The IDE's babyLike others have stated, take a look at IDEA.
I doubt there is a single feature in the
.NET IDE that IDEA doesn't do better (except for GUI builder, of course, since IDEA doesn't have one. It's a tool for developers, after all[1]. :-) ).Check out this review. Or this one.
[1] Actually, a GUI builder is coming in the next version, but it's still in alpha state.
-
Struts is great, but...
I've been working on a reasonably sized project for some time now (still undercover, so can't go into details)... I'd been looking for a good framework to use, and Struts looked like it fitted the bill.
Until I started dealing with the display (view) side of things.
Getting to grips with the Action and ActionForm stuff is simple, and I think that anyone could do it. However, because they expect you to use all the usual standard stuff (taglibs, etc), building new taglibs and dealing with that was going to be a nightmare.
Also, the HTML taglib, when told to output XHTML only, doesn't work. tags like the BASE tag aren't closed properly.
Fortunately, I'd been looking at using Tea earlier on (Jason Hunter uses it at servlets.com). Someone on the tea mailing list posted a link to a very useful article on using Struts for the backend of a web app and Tea for the front end. You can find it here:
http://www-106.ibm.com/developerworks/library/wa-t ea1/
http://www-106.ibm.com/developerworks/library/wa-t ea2/
-
Re:Could you provide a link?`Here's the behind the scenes story from the Apache perspective, written by the Apache representative to the JCP.
Apache's rep,
Jason Hunter -
Re:what is it that Tomcat 4.0 lets me do ... ?
A good introduction to the concepts behind template engines can be found at Servlets.com, along with its followup article.
I'd like to take a look at these documents. Unfortunately the site has been down since yesterday. Do you know when it might be back or where a mirror would be?
-
Re:what is it that Tomcat 4.0 lets me do ... ?
A good introduction to the concepts behind template engines can be found at Servlets.com, along with its followup article.
I'd like to take a look at these documents. Unfortunately the site has been down since yesterday. Do you know when it might be back or where a mirror would be?
-
Re:what is it that Tomcat 4.0 lets me do ... ?But the concept of a "template engine" as you understand it, doesn't specifically require Java, and could be done in say C?
Absolutely. Having said that, one thing that Java gives you is nice introspection capabilities, that is, a template engine is able to look at a set of arbitrary business objects and map them directly into a model that the templates can use.
FreeMarker does it slightly differently, by defining a set of simple interfaces that business objects should either implement directly, or use adapter classes that adapt your business object model to the FreeMarker one. This is probably the approach you'd want to use if you were implementing something similar in C.
I see I didn't explain myself very well in my earlier post. Sorry, I was at work. In terms of the layers between your web server and a template engine, they work as follows:
- At the base, your web server, probably Apache HTTPd, or similar
- Tomcat, which is a servlet container, providing Java's "hook" into processing web requests and responses
- Your template engine, such as Velocity, etc. Technically, JSPs belong at this level as well, though by convention a JSP container is usually bundled with the servlet container. Tomcat is no exception here.
- Finally, your templates and business objects, providing the behaviour for your web site
A good introduction to the concepts behind template engines can be found at Servlets.com, along with its followup article.
None of the template engines (to my knowledge) use XML to define the template -- a template consists mostly of your presentation output, be it HTML, XML, whatever. The template control structures vary in their formats, from XML-like syntax to something that might resemble Perl or shell script constructs. You'd have to see an example or two to understand what I mean.
Hope this helps,
Nicholas.
-
Re:what is it that Tomcat 4.0 lets me do ... ?But the concept of a "template engine" as you understand it, doesn't specifically require Java, and could be done in say C?
Absolutely. Having said that, one thing that Java gives you is nice introspection capabilities, that is, a template engine is able to look at a set of arbitrary business objects and map them directly into a model that the templates can use.
FreeMarker does it slightly differently, by defining a set of simple interfaces that business objects should either implement directly, or use adapter classes that adapt your business object model to the FreeMarker one. This is probably the approach you'd want to use if you were implementing something similar in C.
I see I didn't explain myself very well in my earlier post. Sorry, I was at work. In terms of the layers between your web server and a template engine, they work as follows:
- At the base, your web server, probably Apache HTTPd, or similar
- Tomcat, which is a servlet container, providing Java's "hook" into processing web requests and responses
- Your template engine, such as Velocity, etc. Technically, JSPs belong at this level as well, though by convention a JSP container is usually bundled with the servlet container. Tomcat is no exception here.
- Finally, your templates and business objects, providing the behaviour for your web site
A good introduction to the concepts behind template engines can be found at Servlets.com, along with its followup article.
None of the template engines (to my knowledge) use XML to define the template -- a template consists mostly of your presentation output, be it HTML, XML, whatever. The template control structures vary in their formats, from XML-like syntax to something that might resemble Perl or shell script constructs. You'd have to see an example or two to understand what I mean.
Hope this helps,
Nicholas.
-
"None of the above"
How about "none of the above" or maybe even a completely different solution: Tea. ...would you rather write it in ASP.NET, JSP, or PHP?"Tea is a simple yet powerful template language. Tea is most commonly used for creating dynamic web pages in the TeaServlet. The TeaServlet is a template engine that works with the Tea template language. The TeaServlet makes it easy for developers to create web applications that separate the data aquisition from the presentation."
You can find out more about Tea by going to Disney's open source website or reading Jason Hunter's "Servlet Programming, 2nd Ed."
-
Problem #1: Java Code Too Tempting
In The Problems with JSP, Jason Hunter, author of the O'Reilly servlets book, paints a different picture from yours about how well JSP serves to make the front end "as purely HTML as possible." Apparently it's quite common for JSP programmers to break the clean separation you describe.
Such non-separation is totally understandable. There are times in a product development cycle when you want to do quick prototyping, and it's convenient to put code right there in the JSP. Problem is, once it gets in it's hard to get out. You have to come up with a class hierarchy and wrap an object and method around the code that you cut out of the JSP. This is doable, but not convenient.
Generally projects have to choose up front whether to go with a rapid prototyping tool like PHP or a strictly structured environment like WebMacro. Or they can go with JSP and have some release management structure in which coding standards are enforced.
Alternatively, they could use BRL for rapid prototyping. If the project grows to require more code separation, it's easy to wrap a procedure definition around code cut from a page, then put that definition in sitedefs.scm. You can make use of all kinds of Java objects as well, though you're encouraged to keep Java-specific code out of individual pages. BRL is not intended to be Java-specific, although the current implementation is.
-
JSP is a Sun marketing tool...designed solely to convert 'programmers' familiar with ASP. See the following for a good discussion
:There are plenty of better alternatives out there - this article mentions some, just search past slashdot for more.
-
Thoughts about licence messesI'm responsible for a package (a servlet toolkit called Jacquard) which is released under BSD-style licence. Recently, I needed to add some regular expression functionality, and initially used the GNU RegExp classes. But because of licence problems I stripped them out and replaced them with the Apache Jakarta RegExp classes.
Now I need to add file upload capability; there is a file upload component out there, but the license is weird and definitely not compatible with what I'm doing. So I'm going to have to reinvent that wheel, and I'm going to have to do it 'clean room' even though I know that there are a lot of tricky little tweaks which someone else has already sorted out...
There's no doubt that open source licensing is a bit of a mess. I've a great deal of respect for RMS; we wouldn't be anywhere like where we are now without him. But at the same time after a lot of thought I've decided that the BSD-style licence is best for what I'm doing, because I want my work to be useful to the widest possible number of people and that explicitly includes people working in shops where they aren't realistically going to be allowed to publish their mods.
I'm increasingly of the opinion that life would be a lot simpler, and we would get a lot more innovation done, if the Intellectual Property laws (including copyright) were just scrapped. And yes, I do earn my living doing this.
-
Thoughts about licence messesI'm responsible for a package (a servlet toolkit called Jacquard) which is released under BSD-style licence. Recently, I needed to add some regular expression functionality, and initially used the GNU RegExp classes. But because of licence problems I stripped them out and replaced them with the Apache Jakarta RegExp classes.
Now I need to add file upload capability; there is a file upload component out there, but the license is weird and definitely not compatible with what I'm doing. So I'm going to have to reinvent that wheel, and I'm going to have to do it 'clean room' even though I know that there are a lot of tricky little tweaks which someone else has already sorted out...
There's no doubt that open source licensing is a bit of a mess. I've a great deal of respect for RMS; we wouldn't be anywhere like where we are now without him. But at the same time after a lot of thought I've decided that the BSD-style licence is best for what I'm doing, because I want my work to be useful to the widest possible number of people and that explicitly includes people working in shops where they aren't realistically going to be allowed to publish their mods.
I'm increasingly of the opinion that life would be a lot simpler, and we would get a lot more innovation done, if the Intellectual Property laws (including copyright) were just scrapped. And yes, I do earn my living doing this.
-
JSP/Servlet hosting on LinuxLinux and Java don't go well together? Linux geeks stay away from Java? Bullshit.
Please give some respect to the Blackdown guys and their fabulous work. Thanks to them, I can run my Advanced Imaging servlets on Linux!
And by the way, most of the ISPs who offer Servlet hosting run Linux. Isn't that enough proof?
-
Re:Another one?TEA is a templating system similar to WebMacro. As I understand it, TEA keeps the Java code completely off the HTML unlike JSP which is a mix of HTML, custom tags and Java code.
Check out this article The Problem with JSP for more reasoning behind it.
BTW, cat-ing your code to a file is for girls. Real programmers use copy con program.exe
-
Re:Flawed logic?
My understanding (and this is second hand, so take it with a few grains of salt) is that PHP4 actually compiles to bytecode now, and that the compiler will just help you distribute that bytecode. Of course, if this is true, I don't understand why Zend doesn't have PHP Compiler ready now...
Now, about JSP: instead of me trying to convince you why it should be thrown away, read this great article from Servlets.com --hardly the place for Java critics...
engineers never lie; we just approximate the truth. -
My experienceJust for the record, I've used perl for straight CGI, ASP (using VBScript, JScript and ActiveState's PerlScript), and most recently JavaServlets.
I tend to shy away from the ASP/JSP/PHP3 paradigms just because they integrate presentation with the code. It means designers and coders will be working in the same domain. Jason Hunter has an article contrasting JSP (and the models like it) to what he favors, a template system.
We're presently using Java Servlets with our own home-grown template system. Java is a pretty darn good language, in my opinion. It has nice, consistent syntax, good OO design, and a wonderful set of libraries for just about anything (particulary, threading, RMI and JDBC come in very handy).
It is a valid point that much web work is text processing, simply because HTTP is text-based (and all parameters/info passed back and forth is text based for the most part, too). Thus, regular expressions, and Perl because of its RE support, lend themselves well to web work. However, I know of to regular expression packages for Java, one of which we use. We still hand-code some text processing in inner loops for the best possible speed, but RE's are a tremendous development-time saver.
All of that said, my preference considering the high-level models models I've used would be: Servlets, JSP(/ASP/PHP3), plain out-of-process CGI.
Please forgive me if I have incorrectly lumped ASP, JSP and PHP3 together incorrectly, but I believe, at least from the high-level, they are similar.