for what purpose the c:remove is used in JSTL
Show answerJawab dekhein
<c:remove> removes a scoped variable. Example: <c:remove var="name" scope="page"/> removes the variable name from page scope; if no scope is given it is removed from all scopes.
MCQs, short and long questions from lecture 43.Lecture 43 ki MCQs, short aur long sawal.
0 MCQs · 7 short · 3 long questions0 MCQs · 7 short · 3 long sawal
No MCQs added yet.Abhi koi MCQ shamil nahi.
No MCQs match this filter.Is filter mein koi MCQ nahi.
for what purpose the c:remove is used in JSTL
<c:remove> removes a scoped variable. Example: <c:remove var="name" scope="page"/> removes the variable name from page scope; if no scope is given it is removed from all scopes.
For what purpose c:remove tag is used.
<c:remove> removes a scoped variable. Example: <c:remove var="name" scope="page"/> removes the variable name from page scope; if no scope is given it is removed from all scopes.
Write a scriptlet that is equivalent to the following fragment of code <c: out value ="${param,id}"default="null"/>
<% String id = request.getParameter("id"); if (id == null) { id = "null"; } out.print(id); %> (The tag is meant as <c:out value="${param.id}" default="null"/>: print the request parameter id, or the text "null" if it is missing.)
Which four tag libraries are combined to form a single JSTL?
Core (prefix c), XML (x), Internationalization/Formatting (fmt) and SQL/database (sql).
Write tag library of these: EL based internationalization; RT based xml
EL-based internationalization (formatting) library: <%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %> RT-based XML library: <%@ taglib uri="http://java.sun.com/jstl/xml_rt" prefix="x_rt" %>
EL version and RT version
JSTL has two versions of its libraries: - EL version: tag attributes take EL expressions, for example <c:out value="${param.name}"/>; it is used with JSP 2.0 and later. - RT (request-time) version: tag attributes take JSP request-time expressions, for example <c_rt:out value="<%= request.getParameter(\"name\") %>"/>; it is compatible with earlier JSP versions that do not support EL. They use different taglib URIs (for example .../jstl/core and .../jstl/core_rt).
Core Tags formats
The JSTL core library is included with <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>. Its main tags and formats: - <c:set var="name" scope="page" value="expression"/> sets a scoped variable - <c:out value="${expression}" default="..."/> displays a value - <c:remove var="name" scope="page"/> removes a scoped variable - <c:if test="${condition}"> ... </c:if> conditional - <c:choose>, <c:when test="...">, <c:otherwise> for multiple conditions - <c:forEach var="item" items="${list}"> ... </c:forEach> iteration - <c:forTokens>, <c:import>, <c:url>, <c:param>, <c:redirect>, <c:catch>
describe twin libraries
JSTL comes in two versions (twin libraries) for different skill sets: 1. EL version: dynamic attribute values are given with the Expression Language, ${expression}. Example: <c:out value="${param.name}"/>. URIs such as http://java.sun.com/jsp/jstl/core (prefix c). 2. RT (request time) version: dynamic attribute values are given with JSP expressions, <%= expression %>. Example: <c_rt:out value="<%= name %>"/>. URIs such as http://java.sun.com/jsp/jstl/core_rt (prefix c_rt). Both provide the same core, xml, fmt (formatting) and sql tag libraries.
EL based XML and RT based XML
JSTL comes in two versions. In the EL (Expression Language) based version, dynamic attribute values of JSTL tags are given with EL expressions, e.g. <c:out value="${param.name}"/>. In the RT (Request Time) based version, dynamic attribute values are given with JSP expressions, e.g. <c_rt:out value="<%= request.getParameter("name") %>"/>. Each version has its own tag-library URIs and prefixes (for XML: x for EL based, x_rt for RT based); the EL version is simpler and preferred.
Implement the following code using JSTL tags: <% ArrayList students = (ArrayList)request.getAttribute("sList"); for(int i=0; i<students.size(); i++) { StudentInfo s = (StudentInfo)students.get(i); String name = s.getName(); %> <%= name %> <% } // end for %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <c:forEach var="s" items="${requestScope.sList}"> <c:out value="${s.name}" /> </c:forEach>