Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Java Books Media Programming Book Reviews

Web Development With JSP 102

This "dynamic content" thing doesn't seem to be going away, does it? Web sites need to get smarter to handle the types of content that at least some people want to see on them these days, and the coders and designers behind them need the tools to make them so. Accordingly, Gavin Bong crafted this review of Web Development with JSP, which may be one of the tools you need.

Web Development with JSP
author Duane K. Fields and Mark A.Kolb
pages 543
publisher Manning
rating 8.5
reviewer Gavin Bong
ISBN 1884777996
summary Comprehensive coverage of JSP1.1. Suitable for beginning to intermediate Java developers.

Prologue

Before I proceed with the review, I feel obligated to respond to Jayakrishnan's review of Core Servlets and JSP and Slashdot readers' comments.

I share the sentiments of most people that the use of JSP scriptlets (Model 1) is bad practice. The mantra, "Thou shalt not mix HTML and Java code," should be tattooed onto every JSP developer's forehead. And as the author and readers have suggested, either choose a Model 1.5 (JSP or custom tags with JavaBeans) or Model 2 (MVC) to implement moderate- to high-complexity Web applications.

However, I believe that the authors of this first generation of JSP books need to inform the populace of what JSP is fully capable of (warts and all) -- in order for developers to appreciate the other paradigms. And beyond that, these authors must then educate on how not to use JSP. And I believe that will be the difference between a complete JSP book and an incomplete one.

Secondly, JSP Model 1 has been often described as "servlets lite." It is a good paradigm for prototyping servlets. For example, SOAP4J (IBM's SOAP framework) was released using a JSP scriptlet to dispatch SOAP RPC invocations. The software has since been donated to the Apache group and in the latest public release; the aforementioned JSP scriptlet is now a servlet.

So on that note, let me begin the review.

Topics covered

The book starts with a survey of precursor technologies to JSP in Chapter 1 and quickly moves into the real subject matter. It is clear from the start, that this book is written with the Java programmer in mind. I'd say that only the first five chapters are useful reading for a JSP page designer. Concepts like "How to setup a JSP/Servlet engine?", "Incorporating applets with tag," JDBC, JNDI, and EJB are either relegated to the Annexes or lightly mentioned before detailed treatment follows. The authors only cite HTML and Java as prerequisites but it's more accurate to say that readers also need to have some knowledge of core J2EE services like servlets. Here's a tip: have the JSP v1.1 and Servlets v2.2 specifications within close reach when reading the book.

The book covers all the core JSP topics; here's a sampling:

1. JSP and JavaBeans
The book provides a very readable introduction to JavaBeans for those unfamiliar with it. This is required reading for those implementing the Model 1.5 architecture. However, features specific to visual-oriented beans are not covered. Page designers should specifically devour Chapter 5 on JSP bean tags. The two notable samples provided are:
  • CachedRowSet Bean - An example of paging through results using the JDBC 2.0 RowSet interface.
  • JDBC Transaction Processing - An example of maintaining a JDBC transaction across several JSP pages using a Database Connection Bean and JSP implicit objects.
2. JSP Performance/Scalability
Performance and scalability issues are discussed accross several chapters. The authors attribute JSP's performance to servlet performance, which is tied to JVM server memory. No rule of thumb on sizing JVM server memory is given, but a tip is offered on how to use the serializable interface to estimate the size of Java objects that will be placed in the session object.

Session migration over multiple load-balanced machines is touched upon lightly but no technical details were offered. I would have liked to see a practical example on session persistence coupled with a use case of load balancing a JSP website. It's unfortunate also that the authors didn't think that database connection pooling warrants a practical example.

3. Multithreading


Throughout the book, readers are reminded to be aware of thread safety issues when dealing with shared resources (e.g. JDBC Connections). This tip is offered: "Examine all static variables & objects whose scope is session or application."

4. Exception Handling
A comprehensive coverage on how to handle exceptions in a JSP web application is provided and covers these areas:

  • Error pages in JSP
  • Null properties in JavaBeans
  • Undefined values in Database tables
  • Handling exceptions in servlets (JSP Model 2)
5. JSP Web application architectures
In Chapter 8, the page centric architecture (Model 1) is compared to a servlet centric one (Model 2). A discussion on the servlet RequestDispatcher interface culminates with a sample, that demonstrates how a servlet dictates application flow; relegating JSP pages to provide only presentation services, when called upon. A more complicated sample using this architecture is developed in Chapter 9.

6. Deployment
The book provides complete information on WAR files and Deployment Descriptors.

7. Three chapters of code samples
One full chapter is dedicated to a sample implementation of a real world example of a faq-o-matic tool. Also provided are two chapters of code snippets for Web-based functionality like form handling, cookie management and JSP's marriage with Javascript.

8. Custom tags
The last two chapters are dedicated to this very unique feature of JSP and in it they provide sample custom tags for content substitution and translation, coverage on how to package taglibs and more advanced techniques incorporating Java reflection in custom tag helper classes.

Weaknesses

The book comes with eight pages of errata - mainly spelling/naming errors in the code. I think publishers need to ensure that code be proofread as diligently as the prose. Fortunately the book has a Web site (taglib.com) with a link to a Web-based public forum.

The JSP API in Annex E is presented in the same style as Oreilly's Java in a nutshell book. A UML diagram would have been nice.

And finally, just like in the Core Servlets and JSP book; there's no mention of i18n or security. But this is probably a moot point since you gain i18n features directly from the Java language itself and the "contentType" @page directive attribute. Security of a JSP application is largely dictated by the Servlet/JSP engine configuration (albeit you can plug in your own authentication/encryption schemes) and would be better covered in a book dedicated to system administration and other deployment issues.

Is it worth buying?

It is important to mention that this book covers JSP 1.1 and Servlet 2.2, the production release of each technology. Recently JSP 1.2 and Servlet 2.3 have both entered the Proposed Final Draft stage. So the question is: should you wait for a new edition? My suggestion is: go buy the ebook version (in PDF) from Manning's website. And at a price of $16.50, that's a steal.

In terms of content, the book offers good value in its coverage of deployment issues, different JSP architectures and not forgetting some really good material on custom tags/taglibs. And by advocating an MVC styled development architecture; everyone from your JSP page designers, JavaBean/servlet developers and DBAs will be less coupled - and your code more maintainable.

Table of contents

  • Chapter 1: Introduction
  • Chapter 2: Fundamentals
  • Chapter 3: Programming JSP scripts
  • Chapter 4: Actions and implicit objects
  • Chapter 5: Using JSP Components
  • Chapter 6: Developing JSP Components
  • Chapter 7: Working with databases
  • Chapter 8: Architecting JSP applications
  • Chapter 9: An example JSP Project
  • Chapter 10: Deploying JSP applications
  • Chapter 11: Performing common JSP tasks
  • Chapter 12: JSP by example
  • Chapter 13: Creating custom tags
  • Chapter 14: Implementing advanced custom tags
  • Annex A: Running the reference implementation
  • Annex B: Incorporating Java applets
  • Annex C: JSP resources
  • Annex D: JSP syntax reference
  • Annex E: JSP API reference


Besides the PDF version, you can also purchase this book at Fatbrain.

This discussion has been archived. No new comments can be posted.

Web Development with JSP

Comments Filter:
  • by Anonymous Coward
    re: apache javabeans stuff. If you are looking for Enterprise Java Beans checkout JBoss (www.jboss.org) an excellent open source EJB server integrated with Apache. It rocks.

    pj
  • by Anonymous Coward
    At work we are running an IIS frontend (static stuff - mostly GIFs) and a WebLogic backend with a variety of database connections (though we may move to Apache/Linux or BSD soon). Virtually 100% of pages are dynamically created.

    Servers are 2GB RAM, Dual Pentium 700. We have a redundant setup (two front ends, two back ends).

    Bottom line: we routinely serve >> one million pages per day with peak hours well over 100,000 pages (well over a million hits when gifs are included). A loss of one server degrades performance at peak times but only slightly.

    Assuming by hits you mean dynamically generated pages then you are running at ~1% of what we do so you should be fine on CPU. The RAM looks light, though and swapping can kill you.

    'Course "your mileage my vary" - there are too many things that influence performance to be able to just say x hits/day = y CPU.
  • by Anonymous Coward
    well since readership is about 50% script kiddies that think tweaking enlightment setting is "real technology"...

    Fact is, like or not, Java is today the DOMINANT platform, by far. .NET is still paper. Also it is the best advocat of Linux as a platform in deployment environments.

    You have to understand this is real, much $$$ at stake and a FULL INDUSTRY today squarely pushing the computing envelope with Java (thinking of server side mostly, EJB etc etc).

    I stopped really reading the /. threads on java about 2 years ago (ok i still do from time to time as you can tell ;-) because 30% was still "applets" showing the naivete and poor level of most the readers.

    Now (and being a hardened professional) I am still amused at the "jsp/no jsp" discussion going on but very pleased by the status of some of the open source efforts going on (particularly in the EJB space) so i understand it is not all BS out there.

    pj

  • Uh huh... found that out at my third degree.

    Fraternally,

    Bro. Mark
    VanRensselaer Lodge, No. 87, F&AM of NY
  • RAM is what counts most. Followed by disk access speed, db drivers, network cards/drivers and finally CPU.

    The best machine for the job [javaworld.com] is an AS/400, but your Pentium is probably up to the task. More RAM would help heaps.

  • When I worked for big blue last year they sent an internal email trumpeting the fact that the AS/400 was the fastest computer you could buy in a box. All their higher up machines came with support contracts, etc. Not sure if that's true today.

    I've liked the AS/400 as a backend, but why do shops who use them insist on making me enter my timesheets direct to the green screen?

  • as/400 is a pretty good machine. unfortunately, shops that use as/400 tend to believe anything ibm says to them, so they install webshere on it, and shit do i hate that product.. grrr i'm advocating to keep db2 on as/400 but at least use jboss on linux/unix or even nt. but still, many it director has a very conservative mind and strongly believe that if a product cost a lot of $$$, it's because it's good.

    anyway, that was my rant. did i say that i hate websphere and visual age??

  • Struts is very interesting (a MVC framework in the spirit of the java petstore example).

    also there's Cocoon if you want to do some XSLT.
  • >>A better reason to dislike JSP is that it doesn't enforce the seperation between content and presentation. An XML + XSLT/XSP with Cocoon is an alternative that is, IMHO a cleaner solution.

    -------

    i agree. the problem with xslt is i don't know any graphic artist that know what it is. is there any wysiwig xslt editor??

    in the meantime, i think that jsp with a good tag library is a good compromise. java code in a jsp file should be avoided!!

    anyway, i do most of my pet project with xml (generated on the fly by a servlet) and i apply an xsl stylesheet to it. i use jsp mostly as a glue (dataislands) or sometimes to generate a stylesheet.

  • i strongly recommend jboss too. (you can download a version with an embedded tomcat, jboss and tomcat runs in the same vm so it's much faster). jboss is really easy to setup (a couple of environment variables, launch a script). put your .war/.ear in the deploy dir and bingo.

    jboss suffers in the documentation area, but really, it's so easy to set up compared to commercial product like websphere that the readme file is enough.
  • This is not intended as an insult, but a PalmPilot could serve 1000 hits per day. Even if they all happen during one hour, that's a hit every few seconds. I suspect if you optimized it, the PalmPilot could do this when programmed in Java.

  • Tomcat has improved greatly... it's not as fast as some others, but is now OK for a great # of uses.

  • I "third" the recommendation of JBoss, and point out that JBoss is leading the way in some areas of EJB implementation especially in its pluggable architecture, use of JMX management, and standards compliance.

    It's also vastly easier to get working than the other EJB server we have around here, WebSphere.
  • There are certainly exceptions, especially amongst people who have developed and documented HTML template languages of their own - kudos on that! But I'm really talking about what the majority of the business market is doing, which drives what is popular and ubiquitous, often apparently regardless of technical merits.

    You also highlighted an important point about Java's success: since the JVM has become such a standard, some things have now become possible that might have been viewed with more suspicion in the past. I don't think you'd be stretching the truth too much to bill your solution as Java-based, although problems might arise if the code needed to be maintained by non-Scheme programmers.

    Given Scheme's parsability, though, a translator to JSP might not be that difficult - or perhaps more perversely, a good Java decompiler could convert Kawa-generated bytecode back into Java... ;^)

  • Which is an ironic comment given that i18n stands for internationalisation.

    john
  • I would suggest either the latest version of iPlanet, Apache's JServ. . .


    If you're going to do servlet / JSP stuff with an Apache tool, use tomcat - that's where the majority of the development has been focused for the last year or so.

  • I certainly agree with gfxguy that putting in bells and whistles just because you can is a sure sign of Dispicable, Clueless, Programming Practices. However, there is a place in the Real World for dynamic content.

    Example: We have a site on our Intranet where jobs are posted. The practice was the client sent me a WP document from which I would extract the content, format it and then publish. Now, the client goes to a form page where the data is entered into a database. The server then takes that data and constructs the published pages. The savings in work time are (at a minimum) 50%.

    Just my 2 cents to remind yez all that there is a place for dynamic content. Just mind what gfxguy was griping about. Don't get so carried away with the Neat Stuff that you screw up the client's experience on your web site.

  • This is sure to confuse many a /. reader at the bookstore. I know I find myself often chosing O'Reilly over very similar books, often out of habit. And consistency is nice as well.

  • No, it's specifically the developers who use ASP who also tend to write awful HTML, because their heads are so far up their butts that they see no problem with giving the finger to 20% of their clients who have mac, free os, non-standard browsers, or even just sucky IE setups with weird builds and weird problems you see nowhere else.

    Assuming that javascript is available is a major common sin.

    But it's not the tool, it's the developers that are the real problem.

    Boss of nothin. Big deal.
    Son, go get daddy's hard plastic eyes.

  • While interesting, *Philip and Alex's Guide to Web Publishing* doesn't tell me much about JSP.
  • The main reason that Java runs fast on AS/400s is because you can compile the 32-bit Java bytecode to native 64-bit programs (CRTJVAPGM is the command IIRC - haven't played with an AS/400 recently).

    That, and the fact that for raw I/O performance AS/400s rock.

  • Try JDE (Java Development Environment for Emacs). I've heard lots of great things about it. Don't let the fact that it works with emacs scare you away -- it seems really full featured -- stepping through code in multiple processes, class hierarchy displays, javadoc documentation for a class by hitting a hot key, etc.

    Here's the url:
    http://sunsite.dk/jde/
  • can anyone point to a good (preferably online, but not required) resource for what he calls "JSP's marriage with Javascript"? feel free to substitute ASP for JSP.

    i develop web applications and i've never read a good resource on this specific topic. i'm a firm believer is separation of presentation and business logic, but i've only seen XML-RPC and SOAP really offer an elegant solution to this problem.
  • Jakarta is the name of the project, while Tomcat is the product.

    I wouldn't touch Tomcat with a 10ft stick. Its performance is really sluggish; and its overall maturity level is remarkably behind the other free/commercial alternatives. IMHO, the best JSP engine you can get for free now is Resin; it also happens to be the easiest one to set up. It's available at Caucho's site [caucho.com]. It's still possible to run Resin alongside Apache so Apache takes care of the static HTML pages while Resin handles the JSP. In my experience it was the ideal solution, and I scrapped JServ as soon as I discovered Resin.

  • Ah Hah! I bet you expected to find a java hating bigot. Nope, just a JSP hating one. If you want something similiar to JSP, but much more interesting (for a number of reasons I won't mention here, go to the webpage lazy ass) try Apache's Cocoon [apache.org]

    With a name like Apache it's gotta be good...

  • Try www.theserverside.com [theserverside.com].

    The information it provides is exactly what you appear to require, assuming that you are genuinely interested in the topic.

  • This explains Models 1 & 2...

    http://www.javaworld.com/javaworld/jw-12-1999/jw -1 2-ssj-jspmvc.html
  • <CODE>This article is written with extremely poor arguments. It seems like a lot of people who responded online, responded favorably. However, most of them said that they could not figure out what was wrong w/JSP but knew something was wrong. This is indicative of a person who does not have a complete understanding of what they are talking about and is looking for "case" to support their assumptions. Let me talk briefly about each point mentioned in the article (I will refrain from quoting content of each point... go read it if you're interested):
    <BR>
    <BR>"Problem #1: Java Code Too Tempting"
    <BR>"JSP makes it tempting to put Java code in the web page, even though that's considered bad design."
    <BR>
    <BR>Who says it is bad design? This statement of "Java code" is so general it is pathetic. What Sun and most authors state is that putting "business logic" in a web page is bad design. That is a very important distinction, because both authors and Sun do advocate putting "presentation logic" in a web page. That is the entire purpose of JSP. Presentation logic may require Java Code... maybe lots of Java Code. And why is that bad?
    <BR>
    <BR>"Problem #2: Java Code Required"
    <BR>
    <BR>Of course it does... read my response to #1. This is the strength of JSP. To be more than a scripting language and have the support of the entire Java API. It can also "hook-up" to other Java services.
    <BR><BR>"Problem #3: Simple Tasks are Hard"
    <BR>"In JSP the best way to do this is as follows:
    <BR>&lt;% String title = "The Page Title"; %&gt;
    <BR>&lt;%@ include file="/header.jsp" %&gt;
    <BR>Your content here
    <BR>&lt;%@ include file="/footer.jsp" %&gt;"
    <BR>
    <BR>"In WebMacro including headers and footers is done easily:
    <BR>#set $title = "The Page Title"
    <BR>#parse "header.wm"
    <BR>Your content here
    <BR>#parse "footer.wm"
    <BR>"
    <BR>
    <BR>Yeah, maybe simple tasks are hard. But I am not familiar with WebMacro, and the example given does not seem so easy! It looks more like the frame of reference of the author. I think the JSP snippet above is simple and understandable.... but that is just my frame of reference. My point is that the author's point is moot. The complaint of having to put semi-colons is almost equivalent of my complaint of the dollar sign before the title variable in WebMacro.
    <BR>
    <BR>"Problem #4: Lousy Looping"
    <BR>"Looping is overly difficult in JSP. Here's the JSP code to iterate over a
    <BR>vector of ISP objects printing the name of each.
    <BR>&lt;%
    <BR>Enumeration e = list.elements();
    <BR>while (e.hasMoreElements()) {
    <BR>&nbsp; &nbsp; out.print("The next name is ");
    <BR>&nbsp; &nbsp; out.println(((ISP)e.nextElement()).getName());
    <BR>&nbsp; &nbsp; out.print("&lt;br&gt;");
    <BR>}
    <BR>%&gt;
    <BR>"
    <BR>
    <BR>This problem completely demonstrates the author's understanding of JSP. First of all, the code for looping is just Java. Anyone familiar with Java can code that in a few seconds. Second, the code used to output to the web user is pathetic and old. The whole reason to move from Servlets to JSP for "presentation logic" is to avoid all the out.print() statments. Just the fact that the author used the out.print() statment shows that he is extremely inexperienced with JSPs. Here would be my version:
    <BR>&lt;%
    <BR>Enumeration e = list.elements();
    <BR>while (e.hasMoreElements()) {
    <BR>&nbsp; &nbsp; %&gt;
    <BR>&nbsp; &nbsp; The next name is &lt;%=((ISP)e.nextElement()).getName()%&gt ;
    <BR>&nbsp; &nbsp; &lt;br&gt;
    <BR>&nbsp; &nbsp; &lt;%
    <BR>}
    <BR>%&gt;
    <BR>
    <BR>"Problem #5: Useless Error Messages"
    <BR>
    <BR>Yeah, I agree... the error messages could be better. That is simply on compilation and I do not think that ASP offers too much more. One thing that I have found useful is to put the option "keepgenerated" set to true on App Servers. This leaves the intermediate .java file (instead of delete it). Then when you get the error message that tells you the line # in the .java file, you can find it. All the .java file is is a Servlet.
    <BR>
    <BR>"Problem #6: Need a Compiler"
    <BR>
    <BR>And? Isn't that obvious. You would need a compilier (or a "sort-of" compiler) for any scripting language... but this is not a scripting language. Yeah, I find it annoying that I need the overhead of an app server jst to run my jsps, but Tomcat is free and pretty good. I have used Weblogic, WebSphere, and Tomcat and they all are very powerful and nice to have. You must remember the scope of JSPs. Although JSPs can be used on small sites, they flex their muscles on large complex sites. Most sites of this nature do not flinch at the fact of needing an industrial strengh app server.
    <BR>The problem here, IMHO is that the author is failing to identify the scope of JSPs. It sounds more like ranting and raving.
    <BR>
    <BR>"Problem #7: Wasted Space"
    <BR>
    <BR>Give me a break. He is complaining about hard disk space!!! Again, I think he failed to realize and identify the scope of JSPs.
    <BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    <BR>"So is there a place for JSP in the future? Certainly. JSP is entirely
    <BR>relevant if what you're trying to do is wean people off of ASP."
    <BR>
    <BR>If this is the only place that he can find a strength for JSPs, he is completely misguided and inexperienced. I almost find the fact that he is writing this article for servlets.com offensive. I deal with large complex projects everyday. JSP is one of the most viable solutions for many of our clients. This is not just a quick decision either. We go through a lot of design and consideration before arriving at these conclusions.
    <BR>A good author would identify and distinguish the differences in uses and compare/contrast a little more responsibly. This author did neither; however, he succeeded in ranting and raving over his opinions based on inexperience giving fuel to people looking for a reason not to like JSPs.
    <BR>
    <BR>Michael
    <BR>
    <BR>- The requirements called for Windows 9x or better... so I installed Linux</CODE>
  • I don't know why they decided to call these people trolls...

    The term was originally the verb to troll, as in trailing a net behind a boat, ensnaring whatever fish happens by. Because of the coincidence of the name for the bridge-dwelling sub-human mythical creatures, trollers came to be called trolls. My guess is this was out of ignorance, not cleverness.

  • Slightly offtopic but I was wondering if readers have any recommendations for IDEs that can be used under Linux to develop JSPs. I know Emacs or vi is sufficient but I find it hard to debug JSPs. I use JBuilder under Windows for similar tasks at work.
  • Session migration over multiple load-balanced machines is touched upon lightly but no technical details were offered. I would have liked to see a practical example on session persistence coupled with a use case of load balancing a JSP website.

    This seems like a pretty critical omission to me. Creating a fast website with lots of server-side computing with a stateless transaction model is tricky, and some description of how to introduce caching of any kind into a load-balanced world seems like the most important single contribution a book like this would make to my library.

    But this is probably a moot point since you gain i18n features directly from the Java language ...

    Yea, lots of managers think that too :-) Sorry, but internationalization cuts right down to the basics of your application design, unless you just want to create separate installations for each language.

  • We've got dual-CPU PII machines (probably about 400-500 MHz) in a load-balanced farm, running NT. (I'd love to run Linux or FreeBSD, but there are definite issues with the fast JVM from IBM on multi-processor machines; like, it doesn't work :-(

    Oh, and 1GB of RAM apiece.

    They do just fine in general. The slow pages are the ones that involve accessing big chunks of the database, though by being less stupid in our database implementation that's getting better.

    Performance analysis (simple page timing logs) have shown that a considerable number of slow pages are the result of slow client links. That problem is exacerbated by the tendency of pages to be big (our pages anyway). That's one thing JSP sure makes easy!

  • I guess what pisses me off the most are things like ASP pages that I can't view on netscape on my SGI.

    If you can't view the page, it's not an ASP problem, it's just plain bad HTML. Again this has absolutely nothing to do with dynamic content. My dynamic content works fine on Netscape (and Opera) because I don't write code to generate bad HTML. Others are not very particular.

  • So you don't like dynamic content because you don't like something that you know is different but seems superficially similar? I'm not sure I get it ...

    Most of the things that make pages slow are stupid counters and ad servers. A few judicious host file entries can really speed up your surfing experience.

  • could you post an example of this? perhaps on your website. I am too an consultant/developer and use servlets quite heavily. I understand what you are getting at, but sometimes I need to see it to really get it.
  • Question: Can anyone recommend a good general primer for dynamic web design? There seems to be a fair selection out there for specific implementations (This book for JSP, a couple of PHP books, lots of Perl and Python stuff.), but I am looking for a more generic sort of "How can dynamic content make my life and my site better?" kinda thing. I admin for a universtiy department, and although I do not handle the web content myself, I feel like it could be improved by the proper application of server intelligence. I am just not quite sure how. If I could, by making backend changes, make the front end of the site prettier , more useable, easier to update, or any combination thereof, I'd be happy to put in the effort, but I am kind of at a loss as to where to start.

  • It would be far better to use servlets that point to special tags on the HTML pages.

    Isn't this called taglibs?

    M.

  • I guess what pisses me off the most are things like ASP pages that I can't view on netscape on my SGI. Do these companies even realize they are losing my business?

    What ASP pages? Why on earth can't you view them in Netscape? ASP just generate HTML. There's nothing specifically about ASP technology that limits it to being viewed in IE as you seem to imply.

    -Ciaran

  • If the coding style you advocate is the standard with Java/JSP programmers, then you're right, I did misunderstand the "separate code from the interface comments".

    You advocate pretty much the same style of programming I do, although I don't have much experience with JSP's. I agree completely - your application/business logic belongs in classes and functions, but code that is used to output variables, database records, etc. usually should be in the HTML(or XML, etc.).

    At least one other poster advocated the "everything in a servlet" approach, stating that it could be changed to a GUI client/server type program more easily. If that is important, then I can see the advantage, however, I think its more likely you will need to work with graphic/web designers and in that case, the "mixing output code with HTML" approach works better.

  • ASP doesn't mean a damn thing about whether or not something is displayable in Netscape (or any other browser for that matter).

    It's the HTML / JavaScript that's generated by the ASP that's the problem.
  • Then it could also be institutionalisation...
    --
    01 13 19
    TVDJC TDSLR AZNGT NWQSH KPN
  • I've been running WebLogic on an AMD K6 350 MHz for a few months now just fine. Probably about 1000 hits/day. The box has 128 MB RAM, of which WebLogic consumes about 32 MB (it doesn't run very well with a smaller java heap).
  • First of all if you don't know how to behave then i would say you should think if you ever post again.

    Maybe my english is not good enough or maybe you just don't can or want to understand what i'am trieng to say. I now that in the and JSP become Servlets. What i'm speaking about is the readability of the code. Not what happens when the code is executed/ interpreted/ etc.. Same thing with the HTML wrapper classes. I'm realy curios if you are just to dump to understand or what. Sure i know that in the background some HTML tags get send to the Browser. The idea is that YOU don't have to do it yourself. Again that has something to do with the readability of your code.

    My hole reply was ONLY about the readability of JSP vs. Servlets. So please, the next time you feel the need to reply, try to understand what the article is about.


    --

  • Excellent post - I'd have modded it up, but I've already posted. :(
  • I wrote a song about this guy, here goes...

    Doot doot doo...
    I suck with php
    Doot doot doo...
    so I'm gonna use jsp
    A-doobie doobie doo...
    don't know wtf i'm doin
    Banana-wow
    but the book i bought says enterprise and java on it so I must be on the right track
  • Yeah, not quite an ontopic reply re: the JSP book, but what about PHP was not up to creating a universal login system? *mysql* might not be depending on your traffic, but that's not really anything to do with PHP.

    I had a quick knee-jerk 'wtf?' reaction to your statement, but I am genuinely curious as to what you found the shortcoming to be that necessitated a switch to JSP.

  • PHP *is* just a language, but takes advantage of whatever context you're in. We've used it in both Apache/Linux situations, and Windows. The windows environment handles the pooling for you there, so it's not an issue. But, yes, connection pooling can be an issue on high-concurrency sites.

    Theoreticall, tying PHP to AOLServer would get you connection pooling too.

    Still not sure how you architected your 'universal login' - I can't figure out what you'd be doing that PHP/Postgres wouldn't be fast enough, except that I know postgres hasn't always been a speed demon.

    PHP wasn't meant to do anything you were trying to do, but application variable-style variables really all that hard in PHP - we 'eumlate' them all the time.

    Not sure how you even *attempted* or *thought* of threading issues with PHP. We've used it for some rather large volume sites for years with no problems at all - threading issues never even came up on my radar as an issue. For standard web apps they're really not necessary.

    Putting things in a 'set' variable - sounds like you're meaning application vars - again, emulating is no big deal.

    Not getting into a flame war, but there's pretty much nothing you can do in your JSP model that I can't do with a PHP model, and probably just as quickly.

    JSP doesn't support true threading - the underlying servlet engine does, but JSP itself doesn't.

    Email me offlist if you want to continue this - I'd like to know what your 'universal login' system is doing that's so complex.

  • I agree. I just started reading it yesterday, but I must say it is a pleasant read.
    The book is also self-contained: if you did a little more than "hello world" in Java, you will be in good condition. There is even decent coverage of Beans and JDBC (I said "decent")
    Don't be afraid of buying this or any other book because it covers "old tech". As an example, I'm returning "Java in a Nutshell" (oh! it covers Java 1.3!) to get the "Core Java 2" books.
  • actually it does - RTFM before making erroneous comments.
  • Different people have different experiences re. management attitudes toward non-mainstream tools. Especially in this employee-favoring technical job market, you can get a lot of freedom once you prove your ability to solve problems quickly. I'm using Scheme for Intranet web apps in daily use by hundreds of employees.

    I suppose if management did start getting hostile to non-mainstream tools, I could bill it as a "Java-based solution". There's just one servlet, which provides the web interface to a Scheme-to-JVM compiler.

  • JBuilder runs on Linux too.
  • Sorry, but I thought that Jakarta was an outdated implementation of Tomcat. The shop where I am the sysadmin wants to go to jsp, like now. What is the difference between them (in a nutshell)? Any info would be great.

    Thanks :)

  • And maybe some perl as well; from hearing about how it can help you do the same thing to many files, maybe I can shave time off of tweaking all 11 TGA files of my Q3 font. Or other trivial things, for that matter.
  • As a consultant/developer who codes in Java, I have found serlvets to be far more useful and flexible than JSP's. With servlets, it is easy to separate the HTML from the servlet code. All the front-end HTML designers need to do is add tags. The servlet can then add content to the web pages by replacing the tags as the servlet is running. With JSP's, the code and HTML are mixed together, creating a gigantic mess. The HTML designers and the JSP coders are constantly stepping on each other's toes. Furthermore, it makes debugging an absolute nightmare. How is someone new to the JSP page going to make ANY sense whatsoever of the garbled mess of HTML and JSP code? It would be far better to use servlets that point to special tags on the HTML pages. In this way, it makes task delegation between the web page designers and the coders all that much easier.
  • Session migration over multiple load-balanced machines is touched upon lightly but no technical details were offered. I would have liked to see a practical example on session persistence coupled with a use case of load balancing a JSP website. It's unfortunate also that the authors didn't think that database connection pooling warrants a practical example.

    The reason for this is that both of these issues (session persistence across servers & connection pooling) are supposed to be handled by your application server. You, as a developer, should not have to worry about their actual implementation, only that it does happen, and of course the limitations of your vendor's scheme.

  • Re: "publishers need to ensure that code be proofread as diligently as the prose" in the review,

    Isn't it much better to test code instead of trying to proofread all the errors out of it?
    I haven't been able to figure out why it it's so common for published code to have errors in it. Why wouldn't they test it and then just paste the code into the book text once it works?
  • There's no clear cut answer to that question. It depends on what your app is doing and how your code is written and what your data looks like and the like.

    You need to to prototype your app in your env to see if it'll work for you. I would suggest either the latest version of iPlanet, Apache's JServ, or JRun. You also need JDK 1.3, it has _major_ speed increases over 1.2 and is quite stable.

  • I would recommend a buy for the sheer joy of discovering what JSP can do to your web pages. One can always buy the latest book when it arrives. It would be easier to understand and master the second time round.
  • I find it interesting that you can post a comment to /. that no one is interested in dynamic content. I'm sure that static pages are all the craze in your neck of the woods, but if you want a web server to store any reasonable amount of information, you'll a shell page with text inserted from database calls. That, my friend, is dynamic content, and /. uses it with perl. The only difference is that some /. pages precompile to .shtml for faster loading.

    JSP pages compile as well, and well-implemented JSP/Servlet server (IE, Allaire's JRun) will do just fine for speed on a reasonable server. Beyond that, JDBC database access is quick and easy, and their connection pooling capability makes even Oracle run fast enough for web purposes.

    Moreover, all e-commerce requires dynamic content, unless you are using static pages and emailing your credit card info to an operator. So don't be so down on the concept. Try to open your mind a little bit, instead of just lashing out at things you don't understand.

  • First of all, database access WAS a problem with PHP. Java has a good implementation of connection pooling, which we needed to access PostgreSQL fast enough for the universal logon.

    Second, we actually ran into threading issues with PHP... you see, we stored logged-in users in a set variable. But PHP doesn't really do a good threading job, and we ran into all sorts of errors... phantom users, etc. Java's Collections Interface has a built-in set object as well as syncrhonization.

    Also, PHP doesn't have the different variable contexts that JSP does. Registering a variable with the page and passing that context to another page allowed for a real servlet-centric application instead of a few unrelated script pages. PHP is just a scripting language - you really do need something more powerful for real apps.

    I appreciate your open-mindedness, though, as opposed to some other unnamed slash trolls who are against anything that might be used for an (oh!) capitalist pursuit.

  • Thanks! I'm at a new job now, though, and we weren't really looking for EJB stuff, just the basics. But when I get back into the development space, I'll defnitely take a look. Tomcat is a pretty damn good implementation except for that rather annoying little bug.
  • It was the latest release of Tomcat as of 11/00, with Java 2, as far as I remember. It was a while ago.
  • For general stuff about dynamic sites, as well as pretty much everything else web design related, you might find some useful articles on webmonkey [lycos.com]. Its unbiased in terms of platforms and has information on programming, serverside stuff and design. Pretty much all the web stuff I do started from things I read there.
  • Creating a fast website with lots of server-side computing with a stateless transaction model is tricky, and some description of how to introduce caching of any kind into a load-balanced world seems like the most important single contribution a book like this would make to my library.

    Here's an article [javaworld.com] covering the load balancing problem.

  • To quote from the last [jwz.org] "Java Sucks" links the original poster provided:

    "I think Java is the best language going today, which is to say, it's the marginally acceptable one among the set of complete bagbiting loser languages that we have to work with out here in the real world. Java is far, far more pleasant to work with than C or C++ or Perl or Tcl/Tk or even Emacs-Lisp."

    Talk about faint condemnation... But now that we've set the rules of engagement, I agree--Java sucks. So where do we go from there? SML servlets?

  • What's that in English? :)

    Standard shorthand for "Internationalization"

    i(nternationalizatio)n
    "nternationalization" has 18 chars.
    i(18)n
    i18n
  • 4-5 years ago applets were a strength.

    Over the last 5 years there has been enormous improvements in every aspect of Internet development.

    Likewise Java has also evolved and moved on.

  • Sorry, I omitted the word "broadcasting". Java doesn't do UDP broadcasting. At least not easily. I think there is a way you can do it, but invovles some security overrides. Anyway, it's a pain in the rear end, and a drawback, in my opinion.

    Sorry about the error.

    - harborpirate -
  • JSP is a whole different animal than running java for client applications, though. Honestly, I think JSP is really one of the areas where Java shines. Java is really nice as a server side language. It works on the client side, but its strengths do not lie in that area. So before you go off saying Java sucks, maybe you should experiment a little with it in server side programming.

    Sure, Java has it's drawbacks (hint: where is UDP?), but it has a lot more positives than negatives, in my opinion.

    I also find it funny that you say Java sucks, and yet the first line of one of the pages that you link to says: "I think Java is the best language going today". He goes on to say that it is merely slightly more acceptable than others, but he does mention that it easier to work with than C,C++,Perl,and Tcl/Tk.

    I'm no Java crusader, but I would like to point out that Java does have its uses, and people shouldn't dismiss it out of hand.

    - harborpirate -
  • Although I agree with you on many points you could have written this a little less trollish.
  • A more fitting name would be the nazi-mods. I'm sure /. must employ an extreme right-wing fundamentalist with absolutely no sense of humor, who has constant mod status, to sift through every post and mod down anything that isn't 100% on-topic.
  • Jakarta [apache.org] is the project. Tomcat is one of the products of the project. In particular Tomcat is the servlet engine. I think the name of the JSP implementation is Jasper, but don't quote me on that.

    Aditionally there are a lot of other things happening in the project, like application frame works, the Jakarta ORO Matcher regular expression library, and a number of other things. Take a look at the site.

    Mark

  • Personally I picked up this book a while ago. I needed to get up to speed on JSP. It is a good read. I didn't find I needed the JSP or the Servlet specification handy to get through it, and I had only a passing familiarity with JSP when I started.

    Mark and Duane deal with the subject well. The chapter on "Architecting JSP applications" is very helpful for someone coming new to the Java way. The coverage of java beans is decent, although I'm not personally a big user of them.

    I would recommend the book as a good starting point for using Java as a web development platform, but as a starting point. Take a look at some of the alternatives to JSP. Personally I've moved away from JSP, and haven't used them in a single large project to date, except in a purely cursorial manner. We've since moved to using Enhydra [enhydra.org] as our framework for using Java on the web. I highly recommend it, but also check out some of the stuff over at the Jakarta Project [apache.org] for some other alternatives to JSP.

    Mark

  • The concept about sepearating code and HTML runs along the same lines as the method-view-interface of Java and other languages, or separating content and layout for HTML/CSS. The separation takes time, and usually more resources than pure optimization, but when you get the bonus is if you wanted to run the SAME engine/content but with a different interface. A good example is HTML/CSS -- you can easily specify different stylesheets for layout depending on the viewing situation: if it's on screen, you can use one that might include all your navigation links, if you're printing, you can use another that hides navigation links, and maybe for those with celphones, you can cut it down to just the skinny. It's also much easier to make changes in one aspect (content or presentation), without affecting the other.

    Now, sure, with JSP and the like, it does seem that all you'll be serving is web pages, so why not intermix the HTML code with Java code? What if with the change of one line, you could run the JSP as an independant app (no browser required?) -- or in text mode? Or whatever other interface might come along next? It's much easier to do that separation now that if the next big thing comes along, you can easily adapt your program, than to rewrite from scratch.

  • I've been running a web server with CGI/apache/perl/mysql initally on a 486/66, and now on a 200MHz Pentium. The former case, the pages were definitely not speedy, and with the 200 behind them, it's much better (what I've written could probably stand for some optimization and mod_perl-goodness, of course). While I know that the scripts I have won't be going to JSP at any foreseeable future, I wonder what sort of power you'd need behind it to make sure the pages ran well. Assume that it's a small-size web site, maybe on the order of 10,000hits/day, with standard db backends where needed. Will my 200Mhz/128megs be able to power it?
  • 'dynamic content' has nothing to do with client-side dynamic technologies - it generally refers to sites that are generating pages on the fly, almost always out of a database, like Slashdot does with perl, or like other sites do with PHP or ASP, or JSP.
  • 1) A page being generated with ASP has nothing to do with whether it's viewable on a certain browser or platform. That has EVERYTHING to do with the person(s) who coded the site, and what that ASP is generating. You can generate perfect HTML or unbelievably _evil_ HTML with ASP, PHP, JSP, or Perl (hello Slashdot!).

    2) What is your problem with cookies & javascript?
  • i18n = internationalisation

    Apparently because it starts with an 'i', ends with an 'n', and has 18 letters in between...

    Cheers,

    Tim
  • The Sperber paper is a good one, although it conflates Java and OO a bit more than it should. All the arguments of this kind against Java are absolutely, 100% correct. From an academic and theoretical perspective, Java certainly sucks almost beyond repair. I've never even heard an academic defense of it (does anyone know of any?)

    At the same time, in a typical business programming environment, all these criticisms are 98% irrelevant. Very often, in these environments, the alternatives are things like Visual BASIC - or COBOL! Languages like Python on the practical side, and Scheme or ML on the academic side, are no more on the radar of most business developers and their bosses, than Smalltalk ever was.

    The reasons for this are many, complex, and intertwined, ranging from history and comfort factors to industry support and available tools. But a big part of it is that the proportion of programmers with the CS experience to recognize the flaws in Java are miniscule. To those happily using it, Java seems like a hell of an improvement on what has gone before, and the criticisms of it seems hopelessly abstract and theoretical.

    Advanced features take decades to reach programming languages used for business. The evolution of business programming languages so far goes something like this: FORTRAN, COBOL, BASIC, assorted 4GLs, Java. Progress, don't you agree?

    Unfortunately, ubiquity in business translates to ubiquity elsewhere, which is partly why Java has started becoming popular as a teaching language. Actually, compared to Pascal which has been a common teaching language in the past, Java isn't bad. For those wanting an "applied" degree that'll let them go out and get a decent job as a programmer, it'll work. But it is sad that people who might aspire to more are being taught Java as a prototypical programming language. Luckily, the smartest, most inquisitive students won't be satisfied knowing just one rather constraining language, so they'll find alternatives.

  • It is a pitty that your web site is written for analysts and wankers because I would really like to use it to learn more about the Java platform particulary in relation to e-commerce/web-applications.

    It's not a pity for analysts (and wankers) who want exactly the sort of information you're complaining about, presented in the style that you're complaining about. Developers, I'm assuming, are expected to have enough intelligence to track down the Java Developer Connection [sun.com], where they would find a clear and concise introduction to EJBs [sun.com]. Or, if they wanted something a lot more in depth, they'd take a look at the EJB specification [sun.com], which thanks to the good design of Sun's site is merely three clicks away from the front page of the Java site.

    The page that you complain about (http://java.sun.com/j2ee/overview.html [sun.com]) is a relatively good non-technical overview of J2EE, and doesn't pretend to be anything else. However, having found it, a quick click on 'documentation [sun.com]', followed by 'tutorials [sun.com]' takes you to yet another developer-level introduction to J2EE which seems to fit your requirements a lot better.

    The only problem I see with the information provided is that it's not great for impatient developers who can't be bothered to look round the site. Perhaps if you'd spent more time reading the navigation options than 'mindless marketing drivel' then you'd have found what you wanted more quickly.

    Incidentally, I always find that you get better results when complaining about issues like this if you at least run your mail through a spell-checker first. ('pitty', 'particulary', 'nosence' etc.) It's always helpful to make a good impression when what you have to say is inherently negative.

  • errrm.

    So you are complaining about:
    • client side scripts that take a long time to load and don't add anything useful to the page
    • server side scripts that take a long time to serve and don't add anything useful to the page


    Soooo, the first thing has nothing to do with JSP, which is server side, and the second thing is about how you perceive the trade-off between performance and content.
    Given that you read (and post to) slashdot -which uses server side CGI scripts, and that you appreciate some customization, you do, infact like dynamic server-side content generation. Just as long as it's efficient.

    JSP offers an alternative to CGI, which, in some situations can be faster than Perl because of the way the server deals with processes. (One process for the Java Virtual machine with threads handling
    requests, rather than one process per CGI request).

    So perhaps your rant was a little misdirected.

    A better reason to dislike JSP is that it doesn't enforce the seperation between content and presentation. An XML + XSLT/XSP with Cocoon is an alternative that is, IMHO a cleaner solution.
  • One thing to make sure of, is that you use a 1.3 JDK. It's much faster and seems slimmer. I noticed a MAJOR difference when I upgraded from 1.2.2.

  • That's such crap! The only people interested in dynamic content are those pushing the tools to create it.

    Are you on drugs? Dynamic content and JSP is not about flashy applets dancing on the screen. It's about HTML that is created on the fly. Like... umm.. well, slashdot.org comes to mind. e-Bay comes to mind. Amazon.com comes to mind. About a gazillion other database driven sites come to mind.

    Even if you don't have dynamic content, it makes a lot of sense to use something like JSP, PHP or ASP (or why not Perl), because it allows you to separate the actual content from the template. If you do a re-design of the site and you have 50000 pages, it's easier to just change one template than to do some silly Perl script that does a search-and-replace on all of your 50000 html files, complete with re-building navigation etc.

    Yes, you can misuse "dynamic content" but that's hardly a reason to say that "the only people interested in dynamic content are those pushing tools to create it". THAT is garbage.

  • UDP broadcasting.. Hmm.. is that the same as multicasting? If not, what's the difference? I'm asking cause I know Java does UDP multicasting.
  • I run a decent sized web site based on JSP and MySQL. To answer your question in a word, no. We currently have a small farm of Linux boxen (IBM's JDK 1.3, Allaire's JRun 3.0) doing our front end with a MySQL database server behind it all. It's able to handle many more hits than 10,000 / day.

    However, our internal development server is a dinky little Celeron 333 / 156MB RAM with the whole mess on it (MySQL, Apache, Jrun, etc). It works fine for our dev staff, but if several heavy pages are requested too close to one another, the machine bogs down horribly. Could your P200 dish out 10,000 pages a day? Maybe - if every hit was evenly spaced out throughout the entire day. But hits never come like that. You'd need a REALLY fast disk subsystem to keep up with all the swapping you'd be doing. Money that would be better invested in more RAM.

    In order to run a DB driven JSP site, RAM is God. If you can avoid it, don't run the DB server and your web / JSP engine on the same machine. They're both RAM hungry beasts and I find it easier to put together two cheapo machines from spare parts with 128MB of RAM each than one cheapo machine with 256MB.

    The most important thing to keep in mind is that regardless of hardware, your code is what makes the biggest difference. Sloppy, inefficient code will kill you - fast!

    Depending on your content, you might be able to get away with a Slashdot style cache system. You write your JSP to generate the content (a story, etc), then store that in a static file. You can then either serve the static file directly (having a scheduler run the JSP-updater) or include the file into another JSPs output
  • Don't take the subject, "you might be a little confused" the wrong way. I just want to clarify a few things that I think may have been misunderstood.

    "I think its much more natural to do things HTML style such as >(sorry, ASP code here) than try to spit out the HTML from inside a DisplayCustomer() function."
    "Not possible if everything is inside a system.out.println() or whatever."

    Separating of code and HTML does *not* mean that you will be coding out.println() statements from a Servlet or non-jsp code. You must remember that a JSP IS a Servlet. Some authors like to think of them as Servlets "inside-out".

    That being said, the MVC and other designs do not dictate that you print the html from a Servlet... taht would be absurd. If you were do that, then you are not using the power of JSPs.

    Separating of code and html is simply this (in a very simplified form)...
    Code: Put all your business logic and backend connections here.
    HTML: Put all your presentation logic here. This does not mean at all that you cannot put jsp code here... even lots of jsp code here. The point is simply that all the code should be related to the presentation and organization of the presentation.

    Now I will admit that putting all the business logic and presentation logic in a JSP is much easier on "not-so-complex" sites. My approach above is in respect to more complex sites, which I deal with daily.

    So for everyone posting their opinion regarding separation of code and html (or as I would put it, separation of business logic and presentation logic) please distinguish whether you are speaking about complex sites or not-so-complex sites.

    Michael

    -The requirements called for Windows 9x or better... so I installed Linux
  • Reasons for separating out code and HTML:

    • programmers can follow their source more easily as they don't have to pick through reams of HTML to find it
    • less chance of a site builder accidentally corrupting code (slip in cut-and-paste, using an IDE that reformats source, etc)
    • makes page easier for site builder to read


    You will find that in many companies, the job of web application programmer and site builder (HTML) are pretty clearly cut.



    Phillip.

  • That's right - and very often it's ridiculous to have to wait, because the server is so damn busy, when it could have been done in a much simpler manner.

    Slashdot is the kind of place where dynamic content is necessary - and there are dynamic parts of a lot of websites that are necessary. There's also a lot of junk.

    I guess what pisses me off the most are things like ASP pages that I can't view on netscape on my SGI. Do these companies even realize they are losing my business? Because, more often than not, it's a small business running some MS web solution than a place like slashdot, or CNN.

    I don't know. I guess I'm just in a bitch-and-moan mood when it comes to the web. I was trying to look up cellphone plans and half the places I went I couldn't even look at the offerings without cookies or javascript. And even then some of them wouldn't display the content in Netscape on Irix.
    ----------

  • I was just in a lousy mood, my apologies.
    ----------
  • Read both. JSP has its place, and if you're going to use it, or even make an educated decision not to use it, you need a JSP book. But that's just technology.

    Even if you don't go their AOLServer/TCL route, _Philip and Alex's Guide to Web Publishing_ is the best book I've seen about the goals and issues relevant to all non-static sites (plus a lot that's useful for static sites too).

  • designed solely to convert 'programmers' familiar with ASP. See the following for a good discussion :

    The Problems with JSP [servlets.com]

    There are plenty of better alternatives out there - this article mentions some, just search past slashdot for more.

  • I don't always agree with the near religious dogma of separating code and HTML. Yes, your classes and functions should be separate. But the thing we have to remember is that we are ultimately creating web pages.

    In a lot of cases, I think its easier to just mix the code. Say you are presenting a customer a page to update his/her customer information. You retrieve the information in the database, then display it in a form. I think its much more natural to do things HTML style such as >(sorry, ASP code here) than try to spit out the HTML from inside a DisplayCustomer() function.

    In pretty much any programming language I've ever used, the code must somehow interface with the GUI. So if you're doing web programming, I think one should be just as comfortable with HTML as they are with their programming language. To me there are many situations where it is more appropriate to have code interspersed with the HTML than to try to output everything from the classes and functions you are using.

    In my experience, this can be just as flexible and maintainable as doing everything within the code. In the above example, I retrieved the customer record and displayed it in a table. If the underlying data ever changed it would easier to fix this than it would be to change the function. And doing this doesn't prevent me from using classes, functions, or HTML templates that speed development and promote code reuse.

    Not only that, but I have to admit, sometimes when I am working with complex tables(tables that have rowspans, colspans, or nested tables) I will often view them with a visual editor like FrontPage, not because I don't know HTML, but because its faster and more productive. I can still do this if I have code inside the HTML, rather than the other way around. Not possible if everything is inside a system.out.println() or whatever.

  • I forgot to mention how the Beans were busted in the Tomcat implementation...

    What I found was that Bean object had trouble loading via the <jsp:useBean> tag. That tag would load a default Bean with no problems. The book recommended that multiple beans of the same type could be loaded as follows:

    <jsp:useBean id="myBean" class="MyBeanClass"/>

    <% MyBeanClass myBeanArray[];
    for (int i=0; i < myBeanArray.size(); i++) {
    myBean = myBeanArray[i]; %>

    <jsp:getProperty name="myBean" property="myProperty"/>
    <% } %>

    Theoretically, the for loop sets each object in the array to myBean, then displays "myProperty". In Tomcat, myBean in the jsp:useBean context and myBean in the scriptlet context were two very different objects. In fact, that code gave me an error for not declaring myBean as a MyBeanClass instance. I found other people with similar problems, but no official bug report or solution/workaround. Any idea, my geek brothers? :)
  • You are right, Java does multicasting. The difference is subtle. UDP broadcasting sends a UDP packet to all computers on a network segment. Multicasting also sends a message to all machines on a segment, but it uses a special set of IPs. It sends out a packet addressed in a certain range (not your IP) to everyone. One of the problems here is when you try to deal with clients coded in languages other than Java, say C/C++. Multicasting is a harder to implement than a simple IP broadcasting system in most languages, and thus it is a pain to have to work with multicasting just because Java security doesn't allow for broadcasting.

    - harborpirate -
  • by JohnZed ( 20191 ) on Tuesday January 16, 2001 @08:44AM (#504596)
    I run a JSP-based intranet on a 400 mhz celeron with 64 megs of RAM and it could definitely use more memory (buying it next week), but otherwise it runs very quickly and smoothly. Choose your JVM wisely (Sun's tend to be lower memory usage, IBM's tend to be faster), use a good servlet engine (Resin from www.caucho.com is excellent, but Jakarta is pretty slow), and put in a lot of RAM. I don't know about 200 mhz, though. . . that's probably a little lower than I'd use, especially if it also includes to database.
    --JRZ
  • by macpeep ( 36699 ) on Tuesday January 16, 2001 @07:11AM (#504597)
    Sure, Java has it's drawbacks (hint: where is UDP?), but it has a lot more positives than negatives, in my opinion.

    UDP? As in UDP/IP? It's right there with the rest of the networking classes: java.net in such classes as DatagramSocket, DatagramPacket and DatagramSocketImpl.

  • by tshak ( 173364 ) on Tuesday January 16, 2001 @07:02AM (#504598) Homepage
    We've found that with Allaire's JRUN engine, page execution is reasonable on a dual PIII with 256megs of RAM (NT4). We also found it funny that our Allaire Cold Fusion templates could easily out perform our JSP's (sometimes 2:1), but we didn't want to spend the $5K (vs. $1300) on CFEnterprise for the use of CORBA ORBS and EJB's.


  • by scotteparte ( 240046 ) on Tuesday January 16, 2001 @07:24AM (#504599)
    Before the dot-com slide started to knock out all the loser no-content sites, I worked for one such company. We were using PHP and MySQL to do some CD database stuff, and it was going well until we wanted to implement e-commerce and a universal login system (we had several domains, and wanted one login for all of them). Suddenly, we realized that PHP and MySQL would not be enough for the task at hand. So we bought the JSP book.

    I had never used JSP before - I had never even written Java code! But the book was written well for someone with a background in scripting languages, and I found myself working with JSP projects easily in no time at all. I even learned Java from that book, and did so well enough to get a new job and excel at it.

    As far as the book is concerned, there are two parts which especially interested me. The first was their overview of Javabeans, which was done clearly and concisely. However, you should know that when I set up the Apache Tomcat JSP server, Javabeans were busted pretty bad (just a warning).

    The FAQ example (I believe it is chapter 9) was also excellent, because it introduced some very good methods for web application design. The first is the FAQRepository, which encapsulates DB calls into a single class. This enhances portability and allows changes to be implemented quickly in the case of a DB software or design change. The second is the so-called "octopus" design, whereby an intelligent central servlet does the bulk of the processing, and then passes control off to a JSP "tentacle" for minor alterations and display. This keeps code clean and organized, and allows for great scalability.

    I would highly recommend this book to anyone looking to learn JSP as well as develop a strong technique. I know it did wonders for me.

    Sorry about all the buzzwords ;)

  • by LionKimbro ( 200000 ) on Tuesday January 16, 2001 @07:28AM (#504600) Homepage

    Sure, you could read this book...

    OR, you could read Philip and Alex's Guide to Web Publishing [arsdigita.com], and learn everything there is know about creating dynamic web sites, for free. That's right; click on the book, and you'll be face to face with one of the best books (and websites) that I have ever read, period.

    I've bought the book 3 times in print, because it has the highest circulation amongst my book collection.

  • by spooge21 ( 160717 ) on Tuesday January 16, 2001 @07:21AM (#504601) Homepage
    You like reading Slashdot, right? Slashdot could be written in Java using JSP for page generation. This is the type of dynamic content that the author is referring to.

    I REALLY wish people would stop immediately associating Java with eye-candy applets. This is, IMHO, the weakest use for Java.

    As a server side language Java is extremely powerful, primarily due to the huge number of APIs available but also due to the basic design of the language and the core API. Java also promotes code reuse better than any mainstream language out there (once again this is my opinion).

    If you don't like Java as a server side language then don't use it. But please, stop saying Java == applets or JavaScript and using that as a reason to trash the Java platform.

Say "twenty-three-skiddoo" to logout.

Working...