FreeKB - Java Programming JSTL variable using c:set and c:out
Java Programming - JSTL variable using c:set and c:out

Creating variables in JSTL is incredibly easy. First, add the following line to the top of your JSP page.

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

 

Use c:set to create a variable. In this example, a variable called name is created with a value of Jeremy. This is a key:value pair.

<c:set var="name" value="Jeremy"/>

 

This markup should print the value of the variable called name, which will print Jeremy in this example.

${name}

 

In this example, when running the app, "Jeremy" is displayed.



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 0d8a5 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |