Better using c:remove instead.
Here we create an attribute in the request scope using c:set, we show it to the user, and then remove it using c:remove. The scope attribute is optional, but be careful, when not specified all the attribute with the passed name are removed from all the scopes.
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <!-- ... --> <c:set var="userStatus" scope="request" value="Brilliant" /> <br />userStatus: ${userStatus} <c:remove var="userStatus" scope="request" /> <br />userStatus is now: ${userStatus}More on JSTL in chapter nine of Head First Servlet and JSP.
No comments:
Post a Comment