JSTL XML Foreach : XML « JSTL « Java

Java
1. 2D Graphics GUI
2. 3D
3. Advanced Graphics
4. Ant
5. Apache Common
6. Chart
7. Class
8. Collections Data Structure
9. Data Type
10. Database SQL JDBC
11. Design Pattern
12. Development Class
13. EJB3
14. Email
15. Event
16. File Input Output
17. Game
18. Generics
19. GWT
20. Hibernate
21. I18N
22. J2EE
23. J2ME
24. JDK 6
25. JNDI LDAP
26. JPA
27. JSP
28. JSTL
29. Language Basics
30. Network Protocol
31. PDF RTF
32. Reflection
33. Regular Expressions
34. Scripting
35. Security
36. Servlets
37. Spring
38. Swing Components
39. Swing JFC
40. SWT JFace Eclipse
41. Threads
42. Tiny Application
43. Velocity
44. Web Services SOA
45. XML
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java » JSTL » XMLScreenshots 
JSTL XML Foreach


<?xml version="1.0" encoding="ISO-8859-1"?>
<students>
   <student id="1">
      <name>
         <first>Joe</first>
         <last>Y</last>
         <middle>T</middle>
      </name>
      <grade>
         <points>99</points>
         <letter>A</letter>
      </grade>
   </student>
   <student id="2">
      <name>
         <first>James</first>
         <last>Todd</last>
         <middle>K</middle>
      </name>
      <grade>
         <points>92</points>
         <letter>B</letter>
      </grade>
   </student>
   <student id="3">
      <name>
         <first>Kate</first>
         <last>Wang</last>
         <middle>A</middle>
      </name>
      <grade>
         <points>72</points>
         <letter>C</letter>
      </grade>
   </student>
   
</students>


/////////////////////////////////////////////////////////////////////////////////


<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %><%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %>
<html>
  <head>
    <title>For Each Examples</title>
  </head>

  <body>
    <c:import var="students" url="students.xml" />

    <x:parse var="doc" xml="${students}" />

    <table border="1">
      <tr>
        <th>First</th>

        <th>Last</th>

        <th>Points</th>

        <th>Letter</th>
      </tr>

      <x:forEach var="student" select="$doc/students/student">
        <tr>
          <td>
            <x:out select="name/first" />
          </td>

          <td>
            <x:out select="name/last" />
          </td>

          <td>
            <x:out select="grade/points" />
          </td>

          <td>
            <x:out select="grade/letter" />
          </td>
        </tr>
      </x:forEach>
    </table>
  </body>
</html>


           
       
JSTL-XML-Foreach.zip( 6,553 k)
Related examples in the same category
1. JSTL XML Map Value
2. JSTL XML Output
3. JSTL XML Parse
4. JSTL XML XPath
5. JSTL XML XPath Choose
6. JSTL XML XPath Select
7. JSTL XML XPath: Wired New
8. JSTL: parse XML document
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.