How to ignore expression language in jsp?

Sometimes you might want to disable the expression language. Think if you have some template text in your jsp that look like expression language(${something}) then it will be trouble if you do not ignore EL. So when you ignore that HTML looks like EL then the ${} will be treated as any other unprocessed text.
EL is enabled by default. We can ignore the EL by two ways,
1)Through DD:
<web-app>
………….
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<el-ignored>true</el-ignored>
</jsp-property-group>
</jsp-config>
……………
<web-app>
2)Through page directive
<%@page isELIgnored=”true”%>
IMPORTANT NOTE:
Remember the page directive method is dominant over DD method.
Suppose in DD <el-ignored> is true but in page directive it is false. Then EL will be evaluated.
When in DD <el-ignored> is false but in page directive it is true. Then EL will be ignored.

No comments:

Post a Comment