aspose file tools*
The moose likes JSP and the fly likes Mr. Bergsten, a question about JSP 2.0 new features Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Mr. Bergsten, a question about JSP 2.0 new features" Watch "Mr. Bergsten, a question about JSP 2.0 new features" New topic
Author

Mr. Bergsten, a question about JSP 2.0 new features

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
From your point of view, what's the most important new feature within JSP 2.0 new spec. and why ?
Thanks.
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
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 ]

SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
Hans Bergsten
Author
Ranch Hand

Joined: Dec 01, 2003
Posts: 106
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, hans@gefionsoftware.com<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>
Mike Firkser
Ranch Hand

Joined: Oct 21, 2003
Posts: 247

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 Firkser
Rutgers '84
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
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.


42
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
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.
Hans Bergsten
Author
Ranch Hand

Joined: Dec 01, 2003
Posts: 106
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mr. Bergsten, a question about JSP 2.0 new features