OCEJWCD (SCWCD) - 1Z0-899 - Web Component Developer Certification
6.4. Create and use arithmetic expressions in EL.
The expressions inside EL are evaluated at execution time and sent to the output stream.
Inside the brackets we can evaluate conditions or calculate an arithmetic result.
Examples:
${3+7} --> returns 10
${2*(5%3)} --> returns 4
Rules with EL
- EL is null friendly. In case of null or unknown values the page still displays.
- EL treats null value as "zero" in arithmetic expressions.
- EL treats null value as "false" in boolean expression.
6.5. Identify the need for iteration and selection in the view, and use JSTL tags to address those needs.
Example: Creating a servlet that adds a list of elements to the request. Then a list iteration is displayed in the browser.
1) Include servlet declaration in deployment descriptor (web.xml)
<servlet>
<servlet-name>Listado</servlet-name>
<servlet-class>example.Listado</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Listado</servlet-name>
<url-pattern>/List</url-pattern>
</servlet-mapping>
2) Define method get in servlet class
3) JSP using JSTL iteration
Then writing the following url in the browser: http://localhost:8080/ExampleServlets/List a selection list is displayed:
OCEJWCD (SCWCD) - 1Z0-899 - Web Component Developer Certification
No comments:
Post a Comment