By: Abinaya in JSP Tutorials on 2007-09-23
One of the features of the JSP specification that you'll be using most often is the JSP expression language, an intentionally simple language that is, to a large extent, independent from JSP. In previous incarnations of JSP, Java code was embedded into JSP pages in the form of scriptlets, for example:
MyBean bean = new MyBean();
String name = bean.getName();
This scriptlet creates a new instance of a class called MyBean, gets its name property, assigns this to a string variable, and then outputs this string to the page. Now you might be looking at this and thinking, I can achieve the same thing by using the JSP standard actions (<useBean> and <getProperty>).
Although this is certainly true, it was previously extremely hard to write a function-rich JSP-based web application without using a number of scriptlets within your pages. In fact, there are many problems associated with using Java code in the form of scriptlets in JSP pages.
The first and most obvious of these is that it's very common for non-Java programmers to create the user interface for a system. This is because graphic designers are generally better than Java programmers at creating functional user interfaces. The second problem caused by the use of scriptlets is that of maintainability. Embedding large amounts of code into the user interface of a system makes the interface much harder to change and understand.
In fact, both ECMAScript and the XPath EL inspired the JSP EL. The EL specification states, ". . . the experts involved were very reluctant to design yet another expression language and tried to use each of these languages, but they fell short in different areas".
If you've been following the progress of JSP, and the JSP Standard Tag Library (JSTL), you're probably aware that the first expression language was released as part of the JSTL. The EL was then incorporated into the JSP 2.0 specification with JSTL 1.1. At around the same time, the JavaServer Faces (JSF) expert group was developing an expression language for JSF. Because of JSF requirements, the JSF expression language had some differences from the JSP expression language. JSP 2.1 unifies the two versions so that there is a single expression language used for JSP, JSTL, and JSF.
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
- Your name, rating, website address, town, country, state and comment will be publicly displayed if entered.
- Aside from the data entered into these form fields, other stored data about your comment will include:
- Your IP address (not displayed)
- The time/date of your submission (displayed)
- Your email address will not be shared. It is collected for only two reasons:
- Administrative purposes, should a need to contact you arise.
- To inform you of new comments, should you subscribe to receive notifications.
- A cookie may be set on your computer. This is used to remember your inputs. It will expire by itself.
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
- Although the administrator will attempt to moderate comments, it is impossible for every comment to have been moderated at any given time.
- You acknowledge that all comments express the views and opinions of the original author and not those of the administrator.
- You agree not to post any material which is knowingly false, obscene, hateful, threatening, harassing or invasive of a person's privacy.
- The administrator has the right to edit, move or remove any comment for any reason and without notice.
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
Most Viewed Articles (in JSP )
Latest Articles (in JSP)
- Data Science
- React Native
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews