Java/JSTL/Parameters

Материал из Java эксперт
Перейти к: навигация, поиск

JSTL Remove Parameters

   <source lang="java">

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

 <head>
   <title>Set Examples</title>
 </head>
 <body>

Remove Example

 <c:set var="test" value="Hello World" scope="page" />
 The value in the variable test before remove is 
 <c:out value="${test}" />
 
<c:remove var="test" scope="page" /> The value in the variable test after remove is <c:out value="${test}" />
</body>

</html>


      </source>
   
  
 
  



JSTL Request URL And Passing Parameters

   <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:


JSTL: Set page parameters

   <source lang="java">

<html>

 <head>
   <title>Set page parameters (2)</title>
 </head>
 <body>
   This page allows you to enter information that is sent as request
   parameters to another page.
There are two parameters, each with two values.
The next page list the different parameters with their values. <P /> <form action="listPageParameters.jsp" method="get">
Enter an adjective: <input type="text" name="adjective" />
Enter an adjective: <input type="text" name="adjective" />
Enter a noun: <input type="text" name="noun" />
Enter a noun: <input type="text" name="noun" />
     <input type="submit" value="Send parameters" />
   </form>
 </body>

</html> //listPageParameters.jsp

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

 <head>
   <title>List page parameters</title>
 </head>
 <body>
   You entered the following parameters:
    <c:forEach var="pageParameter" items="${param}">
  • <c:out value="pageParameter" /> has the values <c:forEach var="currentValue" items="${pageParameter.value}"> <c:out value="${currentValue}" /> </c:forEach> </c:forEach>
 </body>

</html>


      </source>
   
  
 
  



JSTL Set Parameters

   <source lang="java">

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

 <head>
   <title>Set Examples</title>
 </head>
 <body>

Set With No Body

 <c:set var="str" value="Hello World" />
 str = 
 <c:out value="${str}" />
 

Set With Body

 <c:set var="str">Hello, Again World</c:set>
 str = 
 <c:out value="${str}" />
 
</body>

</html>


      </source>