O'Reilly logo

Struts 2 Design and Programming: A Tutorial by Budi Kurniawan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix B. The JSP Expression Language

OGNL is the expression language used with the Struts custom tags. However, there are cases whereby the JSP Expression Language (EL) can help. For example, the JSP EL provides shorter syntax for printing a model object than what the property tag and OGNL offer. With the JSP EL, instead of this

<LINELENGTH>90</LINELENGTH>
<s:property value="serverValue"/>

You can simply write this.

<LINELENGTH>90</LINELENGTH>
${serverValue}

In addition, there’s no easy way to use Struts custom tags to print a request header. With EL, it’s easy. For instance, the following EL expression prints the value of the host header:

<LINELENGTH>90</LINELENGTH>
${header.host}

This appendix is a tutorial on the JSP EL.

The Expression Language Syntax ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required