Java Reference
In-Depth Information
After filling out the fields in the Insert JSTL If window, as shown in the screenshot,
and clicking OK , the following markup is generated in our page.
<c:if test="${param.displayConditionalText == 'true'}"
var="textDisplayed" scope="session">
</c:if>
We, of course, need to add some markup between the <c:if> and </c:if> tags,
Whatever we add between these two tags will only be rendered if the condition
inside the test attribute is true.
After adding some markup both before, inside, and after the <c:if> tag, the body of
our page now looks like this:
<body>
<h2>Hello World!</h2>
<p>
This paragraph will always be displayed.
</p>
<c:if test="${param.displayConditionalText == 'true'}"
var="textDisplayed" scope="session">
<p>
This paragraph will only be displayed if the request
parameter named "displayConditionalText" has a value
of "true".
</p>
</c:if>
<p>
This paragraph will also always be displayed.
</p>
</body>
We can see how the page is displayed in the browser by right-clicking on it and
selecting Run File from the resulting pop-up menu.
 
Search WWH ::




Custom Search