Loading
 
What's Next: View All Tutorial →

How to access JSTL c:set value in java Scriptlet tag

In this article you will learn how to access JSTL c:set value in java scriptlet tag   Getter & setter in JSTL Tag c:set is used to set the variable value in the jstl tag.   <%@ taglib uri="http://java.sun.com/jsp/jstl/c...

Published Date: 01/01/2015  Last Modified Date: 01/01/2015    New Post



In this article you will learn how to access JSTL c:set value in java scriptlet tag
 

Getter & setter in JSTL Tag


c:set is used to set the variable value in the jstl tag.
 
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<c:set var="str" value="Catchmycity.com" />

<c:out value="${str}"/>  

<%=request.getAttribute("str") %> 

Ouput:

Catchmycity.com
null
 

c:set in scope request


We can set the variable value in the request scope. Then we can access it in the scriplet. Simillarly we can set the scope to session, application and page.
 
<c:set var="str" value="Catchmycity.com" scope ="request"/>

<c:out value="${str}"/>  

<%=request.getAttribute("str") %>
scope="request" will set it in the request. So that we can access it using request.getAttribute

Ouput:

Catchmycity.com
Catchmycity.com
 
Awaiting for Administrator approval




← Back to list


Related Post




×