Java Tutorial/JSTL/import

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

Import Page with Parameter Passing

   <source lang="java">

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

 <c:param name="title" value="Welcome to Page 1"/>

</c:import>

Page 1 information

We"re pleased to introduce Page 1, our newest, most cost-effective product. </body> </html></source>





Import Web Page by URL

   <source lang="java">

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

 <head>
   <title>Import a Page</title>
 </head>
 <body>
   <form method="POST">
          Import
Enter a site to import:
           <input type="text" name="url" size="20" 
             value="http://www.jexp.ru"/>

<input type="submit" value="Submit" name="submit" /> <input type="reset" value="Reset" name="reset" />

 

   </form>
   <c:if test="${pageContext.request.method=="POST"}">

     <c:import url="${param.url}"/>
   </c:if>
 </body>

</html></source>