XmlJstlTest.jsp


Dosyayı İndir
<%@page contentType="text/html"%>
<%@page pageEncoding="iso-8859-9"%>

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

<html>
<body>
    <c:import var="examXml" url="Exam.xml"/> 
    <x:parse varDom="examDom" doc="${examXml}" />
    <h1>Exam <x:out select="$examDom/exam/@id"/> 
        : <x:out select="$examDom/exam/title"/></h1>
    <h3> Questions </h3>    
    <x:forEach var="question" select="$examDom/exam/question">
        <h4><x:out select="$question/@number"/>. 
            <x:out select="$question/text"/></h4>
        <x:forEach var="option" select="$question/option">            
            <x:out select="$option/@id"/>)
                <x:out select="$option"/><br/>            
        </x:forEach>
    </x:forEach>

    <x:parse varDom="customerDoc">
        <customer id="CUS01" type="enterprise">
            <name>Ahmet �zt�rk</name>            
        </customer>
    </x:parse>
    <x:set var="customerName" 
        select="$customerDoc/customer[@id='CUS01']/name"/>
    Customer Name : <x:out select="$customerName"/><br/>
    <x:if select="$customerDoc/customer[@id='CUS01'][@type='enterprise']">
        Enterprise Customer!<br/>
    </x:if>
    <x:set var="customer01" 
        select="$customerDoc/customer[@id='CUS01']"/>  
    <x:out select="$customer01/name"/><br/>       
    <x:choose>
        <x:when select="$customer01/@type='enterprise'">
           <x:out select="$customer01/name"/> 
                is Enterprise Customer!<br/>
        </x:when>       
        <x:when select="$customer01/@type='individual'">
           <x:out select="$customer01/name"/> 
                is Individual Customer!<br/>
        </x:when>    
        <x:otherwise>
           <x:out select="$customer01/name"/> 
                is Unknown Type Customer!<br/>
        </x:otherwise>             
    </x:choose>   
    <c:import var="examXsl" url="Exam.xsl"/>
    <x:transform xml="${examXml}" xslt="${examXsl}">
        <x:param name="examDate" value="3.6.2008"/>
    </x:transform>
    
</body>
</html>

				
Dosyayı İndir

Bu Sayfayı Paylaş:




Bu Sayfayı Paylaş:

İletişim Bilgileri

Takip Et

Her Hakkı Saklıdır. Bu sitede yayınlanan tüm bilgi ve fikirlerin kullanımından fibiler.com sorumlu değildir. Bu sitede üretilmiş , derlenmiş içerikleri, fibiler.com'u kaynak göstermek koşuluyla kendi sitenizde kullanılabilirsiniz. Ancak telif hakkı olan içeriklerin hakları sahiplerine aittir