JSTL xml issue

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


surbex-tAsked:
Who is Participating?
 
siliconeagleConnect With a Mentor Commented:
<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
 
surbex-tAuthor Commented:
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
 
surbex-tAuthor Commented:
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
 
siliconeagleCommented:
post a piece of example XML
also,
<x:out select="$columns"/> should be
<x:out select="${columns}"/>
0
 
surbex-tAuthor Commented:
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
All Courses

From novice to tech pro — start learning today.