Solved

JSTL xml issue

Posted on 2004-10-26
361 Views
Last Modified: 2013-11-24
hi,

here is the portion of my code,

<x:parse doc="${requestScope.resp}" var="respData"/>
<x:forEach select="$respData/Results/Result">
    <tr>
    <c:forEach items="${requestScope.cols}" var="columns">
    <td><x:out select="$columns"/></td>
    </c:forEach>
    </tr>
</x:forEach>

${requestScope.cols} is a array of column names/xml tag name. The problem is that i want to dynamically select out the data base on the array ${requestScope.cols}. But i cannot do it with the way above.
I hope i get this clear for you all

please help

surbex-t


0
Question by:surbex-t
    5 Comments
     

    Author Comment

    by:surbex-t
    Hi,

    To be simple i want to select out the value from the XML that i parse in dynamically base on a string array that i get.

    surbex-t
    0
     

    Author Comment

    by:surbex-t
    nobody got a sollution...?
    forgive me for giving such little points coz this is only points that i got.But i indeed need your help in this.
    Or I posted in wrong section....

    Please help...
    0
     
    LVL 2

    Expert Comment

    by:siliconeagle
    post a piece of example XML
    also,
    <x:out select="$columns"/> should be
    <x:out select="${columns}"/>
    0
     

    Author Comment

    by:surbex-t
    tried that....
    but got error like,

    org.apache.jasper.JasperException: /util/grid.jsp(31,12) According to TLD or attribute directive in tag file, attribute select does not accept any expressions
            at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
            at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:376)
            at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:150)
            at org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:941)
            at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:696)
            at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441)
            at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
            at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
            at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:716)
            at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441)
            at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
            at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
            at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:716)
            at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441)
            at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
            at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
            at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
            at org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
     ......


    surbex-t
    0
     
    LVL 2

    Accepted Solution

    by:
    <x:out select="?"/> doesn't accept expressions.
    looks like you'll need to use
    <c:choose>
    <c:when test="${columns=='columnName'}"/><x:out select="columnName"/></c:when>
    .....
    </c:choose>
    its a bit tedious but it' should work.
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    Title # Comments Views Activity
    abstract class with all non abstract mentods 6 44
    zeroFront challenge 7 47
    wordsWithout 49 51
    endX challenge 2 19
    Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    The viewer will learn how to implement Singleton Design Pattern in Java.
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

    856 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now