The great features in JSP is EL, Tag file and JSTL. In the past, if we write custom tag, we must know Java, just the same case as Servlets. But now, Tag file (can contain plain html and JSP) is a simplified version of writing custom tag, make the case easier (like the invention of JSP). In addition, JSTL and EL make the JSP page more clean. They are tried to use standard method to replace some of the JSP scriptlets, like <c ut> for out.println(). Nick. [ March 10, 2004: Message edited by: Nicholas Cheung ]
Originally posted by Mart�n P�rez: From your point of view, what's the most important new feature within JSP 2.0 new spec. and why ? Thanks.
The most important new feature in JSP 2.0, in my opinion, is the Expression Language (EL). A technology like this needs some way of accessing the data to display and Java (as was used before the EL) is a way too powerful language for this task, making it hard for non-programmers to use. The fact that the Java code snippets added as scriptlets in the page were then mixed with generated code when the JSP page was translated to a servlet only made the problem worse, leading to incomprehensible error messages when things went wrong. The EL is a much simpler language to learn and much more forgiving in terms of data type conversion and null handling. The EL was initially created as part of the JSTL 1.0 specification, but when it was integerated into JSP 2.0, it was also extended with two important features: the conditional operator and function calls. The conditional operator makes it a lot easier to conditionally mark a checkbox as selected, for instance, compared to how it was done in JSP 1.2 with JSTL 1.0:
With JSP 2.0 and the conditional operator you can do the same thing like this:
EL functions are ideal for many tasks where using a custom action is clumsy, e.g., to perform a computation:
Hans Bergsten, firstname.lastname@example.org<br />Author of O'Reilly's<br />- JavaServer Pages,<br />- JavaServer Faces<br /><a href="http://www.hansbergsten.com/" target="_blank" rel="nofollow">http://www.hansbergsten.com/</a>
Mr. Bergsten - To implement this update to EL, will we have to wait for our servers to upgrade to support it, or is this contained in new taglibs. Am I showing my complete ignorance of EL with that question?
A limited EL is available through JSP 1.2 (it works only within the context of JSTL tags version 1.0 there) which is currently supported by most servers. JSP 2.0 is currently not supported by a lot of servers but they are beginning to appear. Tomcat 5 is a good example. You will need this support to use EL outside the context of JSTL.
Joined: Nov 07, 2003
If you want to try writing EL in JSP, you may consider to use Tomcat 5 or WSAD 5. Both of them support EL. Nick.
Joined: Dec 01, 2003
Originally posted by Mike Rutgers: Mr. Bergsten - To implement this update to EL, will we have to wait for our servers to upgrade to support it, or is this contained in new taglibs. Am I showing my complete ignorance of EL with that question?
Mike, Jeroen Wenting and Nicholas Cheung beat me to it: you need a JSP 2.0 container to use the new EL features, but you can use the JSTL 1.0 EL for JSTL 1.0 tag libraries in a JSP 1.2 container. In addition to Tomcat 5, I know that Cacho's Resin 3 supports JSP 2.0, and other vendors have prerelease versions with JSP 2.0. Most hosting companies, in the US at least, use Tomcat or Resin, so if you're hosting your application, you may be able to use JSP 2.0 today.