Java Tutorial/JSTL/Output
Содержание
Do Calculation in JSTL C:Out
<source lang="java">
<%@ page contentType="text/html" %> <%@ taglib prefix="c" uri="http://java.sun.ru/jstl/core" %> <html>
<head> <title>JSP is Easy</title> </head> <body bgcolor="white">
JSP is as easy as ...
<%-- Calculate the sum of 1 + 2 + 3 dynamically --%> 1 + 2 + 3 = <c:out value="${1 + 2 + 3}" /> </body>
</html></source>
Output Default Value
<source lang="java">
<%@ taglib uri="http://java.sun.ru/jstl/core" prefix="c" %> <html>
<head> <title>Out Default Examples</title> </head> <body>testit = <c:out value="${testit}" default="Default Value" /> </body>
</html></source>
Output Form Default Value
<source lang="java">
<html>
<head><title>Create Person</title></head> <body>
Enter your details
<form action="listPageParameters.jsp" method="post">
First name: | <input type="text" name="firstName" /> |
Last name: | <input type="text" name="lastName" /> |
Age: | <input type="text" name="age" /> |
<input type="submit" value="Submit details" /> </form> </body>
</html></source>
Output Value
<source lang="java">
<%@ taglib uri="http://java.sun.ru/jstl/core" prefix="c" %> <html>
<head> <title>Out Examples</title> </head> <body>
Out Example
10 * 3 = <c:out value="${10*3}" />
</body>
</html></source>
Use JSTL C:Out
<source lang="java">
<%@ taglib uri="http://java.sun.ru/jstl/core" prefix="c" %> <html>
<head> <title>Query String Example</title> </head> <body>Your favorite color is: <c:out value="${param.color}" />
Choose your favorite color: