JSTL XML problem

I use Tomcat 5.5.4, Jarkata JSTL 1.1.2, here is what I do:
(1) copy JSTL jar (standard.jar, jstl.jar) to tomcat common/lib directory
(2) create a jsp page like:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<c:import var="data" url="sample.xml" />
<x:parse var="res" doc="${data}" />
if I print ${data}, it is correct XML file as I expected. But I always get [document:null] as XML parsing result.
Besides, whatever JSTL XML function I try, seems all of them give me error or null result.
Is there any special setting that I miss?
Why JSTL:core works and JSTL:xml doesn't?
Anyone have suggestion? Thanks!

To answer your questions from the previous post: No, I don't have Xalan.jar anywhere, unless it is packaged inside of some other jar, like one of the commons jars.
I am using Tomcat 5.0.29 or real close to it. Java 1.4.2.
A further question:
Do I really need copy c.tld and x.tld to WEB-INF/ and
set them up in WEB-INF/web.xml?
No. The tlds inside the JARs are all you need. I would get rid of these copies.
My understanding is: since you specify that uri:
http://java.sun.com/jsp/jstl/core, there is no need
to copy and set-up tld.
At least, if I remove them, JSTL:core works fine. As
for JSTL:xml, it doesn't work either way.What version of the web descriptor are you using? Version 2.3 or 2.4? It should either be defined is a <?DOCTYPE... ?> tag (v 2.3) or in the <web-app ...> tag (v. 2.4). You should be using the vs. 2.4.
I don't know if that would make a difference though...

Similar Messages

  • Problem using JSTL XML tags.

    My xml tag is giving problems. All other tags (core/sql and EL) are working fine. Even a very simple code like :
    <%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <!-- parse an XML document -->
    <x:parse var="simple">
    <a>
    <b>
    <c>C </c>
    </b>
    <d>
    <e> E </e>
    </d>
    </a>
    </x:parse>
    <!-- display using XPath expressions -->
    <x:out select="$simple//e"/>
    gives error as :
    javax.servlet.ServletException: Cannot inherit from final class
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
         org.apache.jsp.jsp.xml.first_jsp._jspService(first_jsp.java:65)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    Pls. help!

    Works with no problems for me. (same exact code posted into a JSP)
    Running on Tomcat 5, Java1.4
    What server are you running, and version of java?
    Is there anything else on the page? Are you extending a class somehow?
    Do you have any extra libraries in the web-inf/lib directory that might be conflicting?

  • Problem in using request parameters in jstl xml code

    hi,
    my need is to get a request parameter and use the variable in jstl(xml) select conditions.
    my code is ,
    <%String txname=request.getParameter("tname");%>
    <x:forEach var="fe" select="$doc/transaction/tx[@tname=${txname}]/field">
         <field>ss <x:out select="$fe/@fname"/> </field>
    </x:forEach>
    i'm using tomcat5.0. I deployed the jstl.jar, standard.jar, jaxen.jar and saxpath.jar in WEB-INF/lib directory.
    I able to run other jstl(xml) files which doesn't need any variables from out side.
    i used the scirpt for getparameter as i unable to get the code ${param.tname}
    help me.
    urs
    pavan.

    Looks like you haven't imported the taglib:
    JSTL1.0: <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    JSTL1.1: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    You use JSTL1.0 in JSP1.2 containers (eg Tomcat 4)
    You use JSTL1.1 in JSP2.0 containers (eg Tomcat 5)
    also check this post if you have further troubles. It has basic troubleshooting for JSTL.

  • JSTL xml not working

    Hi,
    I'm trying to parse an xml document using JSTL XML libraries. The following is a code snippet from my app:
    <x:parse var="ox" xml="${xml}"/>
         <x:set var="pageItemCount" select='count($ox/osSummary/summaryGroup/summaryItem)'/>
         <x:set var="totalRecords" select="string($ox/osSummary/totalRecords)" scope="request"/>
         <c:set var="pages" value="${totalRecords / qp.pageSize}" scope="request"/>
    <<x:forEach var="n" select="$ox/osSummary/summaryGroup/summaryItem">
    I have verified that the 'xml' variable holds the xml document. However, the <x:parse> function does not seem to parse the XML.
    I am guessing there is something wrong with the JSTL version i'm using. If so, how to i change that? I'm using WAS 6.0
    thanks,
    Vasanth

    Had a maybe similar problem a short while ago. Browse this thread and see if that seems like it. Good luck!
    http://forum.java.sun.com/thread.jspa?threadID=5236722
    John

  • JSP/JSTL & XML

    I am trying to have JSP pages parse and read an XML file and then return some data in an HTML table. I'm using the JSTL libraries and have a basic understanding of them, but I apparently need help.
    My first page just gets the value and passes it to the second page. The second page handles all of the processing. Here is my JSP page:
    <%@page contentType="text/html" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
    <%@include file="index.jsp" %>
    <% String clientID = request.getParameter("enteredID"); %>
    <c:import url="npiXMLTest5.xml" var="doc" />
    <x:parse varDom="dom" doc="${doc}"/>
    <x:set var="srcCID" select="string($dom/npiNumbers/client/clientNum)" />
    <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>NPI XJTL Test</title></head>
    <body>
    <c:set var="CID" value="<%= clientID %>" />
    <h2>NPI XJTL Test Page</h2>
    <table border="1">
    <tr><th>NPI Number</th><th>Description</th></tr>
    <c:choose>
    <c:when test="${CID}=${srcCID}">
    <x:forEach select="$dom/npiNumbers/client/npiNum" var="$n">
    <tr><td><x:out select="$n/npi" /></td><td><x:out select="$n/desc" /></td></tr>
    </x:forEach>
    </c:when>
    <c:otherwise>
    There is an error with your coding
    </c:otherwise>
    </c:choose>
    </table></body></html>My XML structure is as follows:
    <npiNumbers xsi:schemaLocation="http://localhost/namespace NPI_XSD5.xsd" xmlns="http://localhost/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <client>
    <clientNum/>
    <clientName/>
    <npiNum>
    <npi/>
    <desc/>
    </npiNum>
    </client>
    </npiNumbers>I am trying to return the results of the <npiNum> element (which can have multiple values) - <npi> and <desc> - in a table based on the <clientNum> element. I try to evaluate the page variable with the xml element. If it matches, I will return a table. A client can have multiple <npiNum> elements, so the construction of the table is in the x:forEach loop.
    I think my problem is getting the variable from JSP to compare against the <clientNum> element in the XML file.
    Any ideas?

    I think your problem is less JSP/JSTL and more querying the XML.
    You are trying to "select all <npinum> elements from a client based on clientnum"
    I am far from an expert on XPath, but I think the following query is what you are after: "/npinumbers/client[clientNum=????]/npiNum"
    To do that with JSTL you would replace ???? with $param:enteredId or $CID (equivalent in your example)
    Here is the resulting JSP page.
    <%@page contentType="text/html" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
    <c:import url="npiXMLTest5.xml" var="doc" />
    <x:parse varDom="dom" doc="${doc}"/>
    <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>NPI XJTL Test</title></head>
    <body>
    <c:set var="CID" value="${param.enteredId}" />
    <h2>NPI XJTL Test Page</h2>
    <table border="1">
    <tr><th>NPI Number</th><th>Description</th></tr>
    <x:forEach select="$dom/npiNumbers/client[clientNum=$CID]/npiNum" var="n">
      <tr><td><x:out select="npi" /></td><td><x:out select="desc" /></td></tr>
    </x:forEach>
    </table>
    <hr>
    <form>
    <input type="text" name="enteredId"/>
    <input type="submit">
    </form>
    </body></html>I made up the following test file to use with it. I don't know if it was exactly what your requirements are, but it was a best guess based on your info.
    <npiNumbers>
         <client>
              <clientNum>42</clientNum>
              <clientName>Ford Prefect</clientName>
              <npiNum>
                   <npi>123</npi>
                   <desc>life</desc>
              </npiNum>
              <npiNum>
                   <npi>234</npi>
                   <desc>universe</desc>
              </npiNum>
              <npiNum>
                   <npi>456</npi>
                   <desc>everything</desc>
              </npiNum>          
         </client>
         <client>
              <clientNum>666</clientNum>
              <clientName>Satan</clientName>
              <npiNum>
                   <npi>333</npi>
                   <desc>Baby Devil</desc>
              </npiNum>
         </client>
    </npiNumbers>Cheers,
    evnafets

  • How to count number of xml nodes , with JSTL XML api?

    I am trying to count the number of nodes in the parsed xml by doing this:
    <x:out select="count($doc/Items/Item)"/>
    There are about 50 item nodes in the source xml, but I get the output as 0
    Is this syntax correct?
    I searched every where but couldn't find the xpath syntax to be used inside jstl xml tags, I was assuming that it's the same as the syntax used in xslt

    Thank you for your reply, sorry I wasnt very clear with my question.
    I want to count the number of nodes inside the jsp file , not inside the xslt file.
    My xml file is something like this for example:
    <?xml version="1.0" encoding="UTF-8"?>
    <DocumentRootNode>
    <Products>
    <Item>1</Item>
    <Item>2</Item>
    <Item>3</Item>
    <Products>
    </DocumentRootNode>
    I want the count of number of Item nodes , in the JSP file.
    I'm doing something like this in the JSP but it gives 0 instead of 3:
    <c:import url="source.xml" var="xml" charEncoding="UTF-8"/>
    <x:parse doc="${xml}" var="xml_doc"/>
    <x:out select="count($xml_doc/Products/Item)"/>
    null

  • IOError in IE but not in Firefox (possible crossdomain.xml problem)

    Yesterday, I hopefully debugged a problem that is occuring for our application in IE but not in Firefox.
    It has to do with accessing remote content from a separate domain.
    In every aspect it APPEARS to be a crossdomain.xml issue but the fact that this issue only arrises in IE is what has prompted me to post here.
    We have a solution in the works (bureaucratically speaking) but I want to double check here.
    Our application is on domain "a.domain".
    It access an xml file on "b.domain/xml/".
    And finally (this is the tricky part) it also accesses an xml file at "b.domain/forwardingPath/" which is actually forwarded to "c.domain/xml/".
    The crossdomain.xml is located at "b.domain/crossdomain.xml".
    The request for "b.domain/xml/anXMLFile.xml" works without any problem.
    The request for "b.domain/forwardingPath/anotherXMLFile.xml" succeeds in Firefox but not in IE (remember, the ACTUAL request is forwarded to "c.domain/xml/anotherXMLFile.xml").
    In IE I get an IOError.
    I believe we need an appropriate crossdomain.xml file also located at "c.domain/crossdomain.xml" and have put in that request.  What I want to confirm is whether this understanding is correct.  I am not a server-side person at all.  It's all elves and fairies to me.  And then finally, why the hell is this behavior inconsistent between IE and Firefox?  Is the Firefox version of flash player violating its own security standards?!
    I am cross-posting this at stack overflow.  http://stackoverflow.com/questions/7395931/ioerror-in-ie-but-not-in-firefox-possible-cross domain-xml-problem

    I've pinged our developers about this and here's what they have to say:
    "We did some work for the plugin around redirects andhence the correct behavior on Firefox.
    AFAIK, on IE we don't get notified of the redirect and can't participate in making security decisions during redirect scenarios. This behavior is out of our control.
    There is a workaround documented in the AS3docs here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/LoaderCont ext.html#checkPolicyFile
    Here is the pertinent paragraph:
    Be careful with checkPolicyFile if you are downloading anobject from a URL that may use server-side HTTP redirects. Policy files arealways retrieved from the corresponding initial URL that you specify inURLRequest.url. If the final object comes from a different URL because of HTTPredirects, then the initially downloaded policy files might not be applicableto the object's final URL, which is the URL that matters in security decisions.If you find yourself in this situation, you can examine the value ofLoaderInfo.url after you have received a ProgressEvent.PROGRESS orEvent.COMPLETE event, which tells you the object's final URL. Then call theSecurity.loadPolicyFile() method with a policy file URL based on the object'sfinal URL. Then poll the value of LoaderInfo.childAllowsParent until it becomes true."
    Chris

  • Working sample of JSTL:xml?

    Can someone send me a working sample war file using jstl:xml under JSTL 1.1/tomcat 5?
    I think my JSP is right, but I tried it on tomcat-5.5.4, 5.0.28 with JDK1.4.2, JDK1.5.0. All of them give me [#document: null] result. There must be something wrong in my configuration.
    If someone can send me a working war file, I would really appreciate.
    My email address: [email protected]
    Thanks!

    Okay, it is clear to me, you are thinking something that may be working is not, because you are testing incorrectly.
    Doing a c:out of the variable returned from <xml:parse> and getting [#document:  null] is not a sign that the xml document wasn't parsed. I am not sure exatly what the null part of the output means but...
    Look at this code:
    //Sidebar.xml
    <?xml version="1.0"?>
    <home_bar>
        <bar_width>250</bar_width>
        <button_height>30</button_height>
        <button_width>200</button_width>
        <button_img>images/norm_button.gif</button_img>
        <button_list>
          <button id="1">
            <link_url>./</link_url>
            <text>Home</text>
          </button>
          <button id="2">
            <link_url>/Calendar</link_url>
            <text>Calendar</text>
          </button>
          <button id="3">
            <link_url>/Calendar/howto.jsp</link_url>
            <text>How To Use the Calendar</text>
          </button>
          <button id="4">
            <link_url>/Webmail</link_url>
            <text>Webmail</text>
          </button>
          <button id="5">
            <link_url>/Webmail/howto.jsp</link_url>
            <text>Webmail HowTo</text>
          </button>
          <button id="6">
            <link_url>/Web/howto.jsp</link_url>
            <text>How To Make a Web Page</text>
          </button>
          <button id="7">
            <link_url>/HTML/howto.jsp</link_url>
            <text>Learn HTML</text>
          </button>
          <button id="8">
            <link_url>/JS/howto.jsp</link_url>
            <text>Learn JavaScript</text>
          </button>
        </button_list>
    </home_bar>
    //Sidebar.jsp
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
      <c:import var="sideBarXml" url="Sidebar.xml" />
      <x:parse doc="${sideBarXml}" var="sideBar" />
      <%-- Show that the side bar was read --%>
        <!-- Side Bar = <c:out value="${sideBar}"/> -->
      <%-- End of Test Output --%>
      <x:set var="theBar" select="$sideBar/home_bar"/>
      <style type="text/css">
        .sidebar
          width  : <x:out select="$theBar/bar_width"/>px;
          float  : left;
          clear  : left;
        .button
          background : transparent url(<x:out select="$theBar/button_img"/>) no-repeat scroll center;
          height     : <x:out select="$theBar/button_height"/>px;
          width      : <x:out select="$theBar/button_width"/>px;
          cursor     : pointer;
          float      : left;
          clear      : left;
          text-align : center;
          color      : white;
      </style>
      <div class="sidebar">
         <x:forEach select="$theBar/button_list/button" var="button" varStatus="status">
           <div class="button" onclick="document.location='<x:out select="$button/link_url"/>';">
             <x:out select="$button/text"/>
           </div>
         </x:forEach>
      </div>
    //index.jsp
    <html>
      <head>
        <title>Showing JSTL:XML tags</title>
        <style type="text/css">
          DIV.content
            disaplay: block;
            float   : left;
            clear   : right;
            width   : 500px;
            font-family: Serif;
        </style>
      </head>
      <body>
        <jsp:include page="Sidebar.jsp"/>
        <div class="content">
          Just some things to show for the content of the JSP...
        </div>
      </body>
    </html>
    //WEB-INF/web.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"
        version="2.4">
      <display-name>XML Display Application</display-name>
    </web-app>
    //HTML Output
    <html>
      <head>
        <title>Showing JSTL:XML tags</title>
        <style type="text/css">
          DIV.content
            disaplay: block;
            float   : left;
            clear   : right;
            width   : 500px;
            font-family: Serif;
        </style>
      </head>
      <body>
        <!-- Side Bar = [#document: null] -->
      <style type="text/css">
        .sidebar
          width  : 250px;
          float  : left;
          clear  : left;
        .button
          background : transparent url(images/norm_button.gif) no-repeat scroll center;
          height     : 30px;
          width      : 200px;
          cursor     : pointer;
          float      : left;
          clear      : left;
          text-align : center;
          color      : white;
      </style>
      <div class="sidebar">
         <div class="button" onclick="document.location='./';">
             Home</div>
         <div class="button" onclick="document.location='/Calendar';">
             Calendar</div>
         <div class="button" onclick="document.location='/Calendar/howto.jsp';">
             How To Use the Calendar</div>
         <div class="button" onclick="document.location='/Webmail';">
             Webmail</div>
         <div class="button" onclick="document.location='/Webmail/howto.jsp';">
             Webmail HowTo</div>
         <div class="button" onclick="document.location='/Web/howto.jsp';">
             How To Make a Web Page</div>
         <div class="button" onclick="document.location='/HTML/howto.jsp';">
             Learn HTML</div>
         <div class="button" onclick="document.location='/JS/howto.jsp';">
             Learn JavaScript</div>
         </div><div class="content">
          Just some things to show for the content of the JSP...
        </div>
      </body>
    </html>The WEB-INF/lib directory contains jstl.jar and standard.jar (JSTL 1.1.1 I think). Nothing but basic Tomcat 5.0.29 installed in the common directories. JDK1.4 installed.
    Anyway, from the output, you can see in the comment inside the HTML source that the c:out for the parsed XML file reads [#document: null]. However, the XML was correctly parsed and generated the proper sidebar.
    I know that if you do something like this:
    <x:set var="theBar" select="$sideBar/home_bar"/>
    <c:out value="${theBar}"/> you get [[home_bar: null]].
    Also, if you do:
    <x:out select="$sideBar"/> you will get all the data from the xml file (not the tags) printed out.

  • Web.xml problem in Enterprise Manager 10g

    I got an error while deploying to Enterprise Manager 10g
    My platform: Windows XP
    OC4J 9.0.4
    Enterprise Manager 10g
    And I even have the web.xml in the correct directory. i.e
    cpd.ear
    ./META-INF/application.xml
    ./cpd-ejb.jar/WEB-INF/web.xml
    ./cpd-webapp.war/WEB-INF/web.xml
    ./cpd-webapp.war/WEB-INF/classes
    The error I get while deploying on a Enterprise Manager 10g is:
    Invalid J2EE application file specified - Jar file: :\WINNT\TEMP\jar47575.tmp is missing its standard xml descriptor located at WEB-INF/web.xml
    Incidently the *.ear file built by my fellow's machine is deploying perfectly. I've compared the directories n useful files of both the *.ears down to the very last bit n they are the same.
    I can imagine that guys with only high IQ can solve this mystery

    The above message is a duplicate of another message by Sim.
    web.xml problem in Enterprise Manager 10g

  • Combing jstl/xml tags with jsf - can't pass parameter

    I'm using the jstl/xml tags to parse portions of an xml document. For some value of an attribute I want to render a search link, many of these links may be rendered on a page and I need to track which one has actually been selected using the id of the generating xml element.
    This is what I've tried, both using h:commandLink and a f:param and t:commandLink (tomahawk) and a t:updateActionListener.
    It doesn't seem to be possible to expose the resolved value of the xpath ="@id" in any way that either the tomahawk or core jsf tags can see.
    <x:when select="$control[@type='SEARCH']">
    <input type="text" id='<x:out select="@id"/>' disabled="true">
    <x:set var="selectedId" select="@id"/>
    <h:commandLink action="#{pack.search}" value="#{msg['actionPack.label.search']}" styleClass="linkNoUnderline">
    <f:param value="${selectedID}" name="selectedID"/>
    </h:commandLink>
    <%--<t:commandLink action="#{pack.search}" value="#{msg['actionPack.label.search']}" styleClass="linkNoUnderline">
    <t:updateActionListener property="#{pack.searchingId}" value="${searchId}"/>
    </t:commandLink>--%>
    </x:when>

    The JSF and JSTL tags don't really play well together.
    Particularly conditional and looping tags.
    My suggestion would be - if you're using JSF, don't use JSTL.
    You are right in that the JSF tags don't bother with the xpath expression.
    Would it be possible to shift the xml logic into an action/bean somewhere, and just present the jsp page with a list of relevant objects?
    If I understand you are trying to determine which link was clicked on a page? In the JSF action "pack.search"?
    What method of iterating are you using? an x:forEachLoop? A datatable?

  • Build XML Document in Servlet use JSTL xml tags in JSP

    Is it possible to build an XML document either org.w3c.dom.Document or preferably org.jdom.Document in a Servlet and pass it as a Bean or Bean property to a JSP and use it in the JSTL xml tags? If so how is it done? I don't want to write the document out to a file.
    Thanks
    Mark

    Both DOM and JDOM allow you to serialize XML to an output stream. Use the StringWriter as the output stream and when its finished you will have the XML in a String. Put the String in the Request scope and your JSP should be able to see it.

  • Log-Configuration.xml Problems

    Hi, I have been trying to use log-configuration.xml but it seems like i cannot get it to work at all.
    From what i understand, once i deploy my application, i should be able to edit the config via the Visual Administrator. However, after i deploy my app, i am still unable to see it with visual administrator. furthermore, i cannot find the file anywhere on the sever. Also, my settings are not reflected in the behaviour of the defaultTrace.
    Am i suppose to be able to find the "log-configuration.xml" file in the server if i have done the correct steps? If so, what are the likely mistakes i have made? I am at my wits end, anyone can help me?
    Just to add, this post seems to describe exactly my situation except i have no idea how to "manually" correct it... log-configuration.xml outside META-INF due to NWDS
    TIA!
    Ah Beng
    Message was edited by: ah beng

    Hi Rajeshkr,
    Sorry, i am kinda new to web dynpro and sap in general so i may need you to be more explicit
    I am not quite sure what this part means or how to check "...has been deployed successfully in the deploy node of the visual Node and check for the Log Configuratior Node and check for your deployed application...."
    What i did do is go to the server to and search the entire directory structure for the log-configuration.xml but could not find it. Also, the config cannot be seen via the log-configurator in visual administration engine which its supposed too i think. and lastly the behavoiur i set in the log-configuration.xml is not reflected in the defaultTrace
    Then i saw this post so i went to check the EAR file in my workspace and found that it was just like Manik described.
    Maybe u could check this link where i posted more about my problem Log-Configuration.xml Problems
    I would love to award points if it helps

  • Tomcat, jstl, jndi problem

    Hi,
    I've been attempting to use JSTL to print out some info from a JNDI datasource (mysql) that I have created in Tomcat. I am running Tomcat 5.0.27. I have tested the JNDI datasource using this code and it works fine:
    <%
         Context ic = new InitialContext();
         DataSource myDataSource = (DataSource) ic.lookup("java:comp/env/jdbc/helpdesk");
         Connection conn = myDataSource.getConnection();
         if (conn == null)
              out.println("The connection was null");
         else
              out.println("The connection was not null");
         Statement st = conn.createStatement();     
         ResultSet rs = st.executeQuery("SELECT * FROM projecttypes");
         while (rs.next())
              out.print("<br>");
              out.print(rs.getString("typeName"));
              out.print("<br>");
              out.print(rs.getString("typeID"));
              conn.close();
    %>However, when I attempt to access the same datasource via JSTL, the tags seem to render, but it doesn't print any values, just the name of the variable. Here is an example:
    The code:
    <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <sql:query var="rs" dataSource="jdbc/helpdesk">
    select typeID, typeName from projecttypes
    </sql:query>
    <html>
      <head>
        <title>DB Test</title>
      </head>
      <body>
      <h2>Results</h2>
    <c:forEach var="row" items="${rs.rows}">
        ID<c:out value="${row.typeID}"/><br/>
        Name <c:out value="${row.typeName}"/><br/>
    </c:forEach>
      </body>
    </html>Here is the output:
    Results
    ID ${row.typeID}
    Name ${row.typeName}I don't understand what's going on, because when I view the source, the tags look as they have been rendered, but I get no database output. But, when I used the JSP scriptlet I had above, it works fine. Also, here are my web.xml, server.xml, and my context file:
    web.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
        "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
         <!-- general application info -->
         <display-name>
              Americas IT Customer Support Website
           </display-name>
           <description>
                Provides helpdesk information and services to Uniqema Americas.
         </description>
         <!-- context parameters -->
         <context-param>
                <param-name>javax.servlet.jsp.jstl.sql.dataSource</param-name>
              <param-value>jdbc/helpdesk</param-value>
         </context-param>
         <!-- servlet info -->
              <!-- standard action servlet configuration (with debugging) -->
           <servlet>
             <servlet-name>action</servlet-name>
             <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
             <init-param>
                    <param-name>config</param-name>
                    <param-value>/WEB-INF/struts-config.xml</param-value>
             </init-param>
             <init-param>
                    <param-name>debug</param-name>
                    <param-value>2</param-value>
             </init-param>
             <init-param>
                    <param-name>detail</param-name>
                    <param-value>2</param-value>
             </init-param>
             <load-on-startup>2</load-on-startup>
           </servlet>
         <!-- servlet mappings -->
              <!-- standard action servlet mapping -->
           <servlet-mapping>
             <servlet-name>action</servlet-name>
             <url-pattern>*.do</url-pattern>
           </servlet-mapping>
         <!-- welcome file list -->
         <welcome-file-list>
              <welcome-file>index.jsp</welcome-file>
              <welcome-file>index.html</welcome-file>
         </welcome-file-list>
         <!-- tld definitions -->
              <!-- struts tag library descriptors -->
           <taglib>
              <taglib-uri>/WEB-INF/tld/struts-bean.tld</taglib-uri>
             <taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
           </taglib>
           <taglib>
             <taglib-uri>/WEB-INF/tld/struts-bean.tld</taglib-uri>
             <taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
           </taglib>
           <taglib>
             <taglib-uri>/WEB-INF/tld/struts-logic.tld</taglib-uri>
             <taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>
           </taglib>
           <taglib>
             <taglib-uri>/WEB-INF/tld/struts-nested.tld</taglib-uri>
             <taglib-location>/WEB-INF/tld/struts-nested.tld</taglib-location>
           </taglib>
           <taglib>
             <taglib-uri>/WEB-INF/tld/struts-tiles.tld</taglib-uri>
             <taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location>
         </taglib>
    <taglib>
        <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
         <taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
      </taglib>
      <taglib>
        <taglib-uri>http://java.sun.com/jstl/fmt-rt</taglib-uri>
         <taglib-location>/WEB-INF/tld/fmt-rt.tld</taglib-location>
      </taglib>
      <taglib>
        <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
         <taglib-location>/WEB-INF/tld/c.tld</taglib-location>
      </taglib>
      <taglib>
        <taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
         <taglib-location>/WEB-INF/tld/c-rt.tld</taglib-location>
      </taglib>
      <taglib>
        <taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
         <taglib-location>/WEB-INF/tld/sql.tld</taglib-location>
      </taglib>
      <taglib>
        <taglib-uri>http://java.sun.com/jstl/sql-rt</taglib-uri>
         <taglib-location>/WEB-INF/tld/sql-rt.tld</taglib-location>
      </taglib>
      <taglib>
        <taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
         <taglib-location>/WEB-INF/tld/x.tld</taglib-location>
      </taglib>
      <taglib>
        <taglib-uri>http://java.sun.com/jstl/x-rt</taglib-uri>
         <taglib-location>/WEB-INF/tld/x-rt.tld</taglib-location>
      </taglib>
         <!-- error page info -->
         <error-page>
              <error-code>404</error-code>
              <location>/errors/404.jsp</location>
         </error-page>
         <error-page>
              <error-code>500</error-code>
              <location>/errors/500.jsp</location>
         </error-page>
         <error-page>
              <exception-type>java.lang.Exception</exception-type>
              <location>/errors/error.jsp</location>
         </error-page>
         <resource-ref>
          <res-ref-name>jdbc/helpdesk</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>
           <res-auth>Container</res-auth>
      </resource-ref>
    </web-app>server.xml
    <?xml version='1.0' encoding='utf-8'?>
    <Server>
      <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
      <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
      <GlobalNamingResources>
        <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
        <Resource auth="Container" description="User database that can be updated and saved" name="UserDatabase" type="org.apache.catalina.UserDatabase"/>
        <ResourceParams name="UserDatabase">
          <parameter>
            <name>factory</name>
            <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
          </parameter>
          <parameter>
            <name>pathname</name>
            <value>conf/tomcat-users.xml</value>
          </parameter>
        </ResourceParams>
      </GlobalNamingResources>
      <Service name="Catalina">
        <Connector acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" port="80" redirectPort="8443" maxSpareThreads="75" maxThreads="150" minSpareThreads="25">
        </Connector>
        <Connector port="8009" protocol="AJP/1.3" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" redirectPort="8443">
        </Connector>
        <Engine defaultHost="localhost" name="Catalina">
          <Host appBase="webapps" name="localhost">
            <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_log." suffix=".txt" timestamp="true"/>
          </Host>
          <Logger className="org.apache.catalina.logger.FileLogger" prefix="catalina_log." suffix=".txt" timestamp="true"/>
          <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
        </Engine>
      </Service>
    </Server>helpdesk.xml (context file)
    <?xml version='1.0' encoding='utf-8'?>
    <Context crossContext="true" debug="5" displayName="Americas IT Customer Support Website" docBase="D:/projects/helpdesk/web" path="/helpdesk" reloadable="true" workDir="work\Catalina\localhost\helpdesk">
      <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_helpdesk_log." suffix=".txt" timestamp="true"/>
      <Resource name="jdbc/helpdesk"
                   auth="Container"
                   type="javax.sql.DataSource"/>
      <ResourceParams name="jdbc/helpdesk">
        <parameter>
          <name>factory</name>
          <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
        </parameter>
        <!-- Maximum number of dB connections in pool. Make sure you
             configure your mysqld max_connections large enough to handle
             all of your db connections. Set to 0 for no limit.
             -->
        <parameter>
          <name>maxActive</name>
          <value>100</value>
        </parameter>
        <!-- Maximum number of idle dB connections to retain in pool.
             Set to 0 for no limit.
             -->
        <parameter>
          <name>maxIdle</name>
          <value>30</value>
        </parameter>
        <!-- Maximum time to wait for a dB connection to become available
             in ms, in this example 10 seconds. An Exception is thrown if
             this timeout is exceeded.  Set to -1 to wait indefinitely.
             -->
        <parameter>
          <name>maxWait</name>
          <value>10000</value>
        </parameter>
        <!-- MySQL dB username and password for dB connections  -->
        <parameter>
         <name>username</name>
         <value>helpdesk</value>
        </parameter>
        <parameter>
         <name>password</name>
         <value>helpdesk</value>
        </parameter>
        <!-- Class name for the old mm.mysql JDBC driver - uncomment this entry and comment next
             if you want to use this driver - we recommend using Connector/J though
        <parameter>
           <name>driverClassName</name>
           <value>org.gjt.mm.mysql.Driver</value>
        </parameter>
         -->
        <!-- Class name for the official MySQL Connector/J driver -->
        <parameter>
           <name>driverClassName</name>
           <value>com.mysql.jdbc.Driver</value>
        </parameter>
        <!-- The JDBC connection url for connecting to your MySQL dB.
             The autoReconnect=true argument to the url makes sure that the
             mm.mysql JDBC Driver will automatically reconnect if mysqld closed the
             connection.  mysqld by default closes idle connections after 8 hours.
             -->
        <parameter>
          <name>url</name>
          <value>jdbc:mysql://webdev:3306/helpdesk?autoReconnect=true</value>
        </parameter>
      </ResourceParams>
    </Context>Ok, I think that's all. Thanks in advance.

    The problem is that your EL is being ignored. This is caused by using an out-of-date web.xml DTD. Your web.xml begins like this:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
        "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>Giving you the 2.2 version of the web app. You want 2.4 (newest version) which you get by doing this:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
                                 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
             version="2.4">to your web.xml
    (No doctype, that long tag is the web-app tag)

  • XML Problem - Markup not well-formed? (kinda long)

    Hello, I'm working on my first AIR app and I've run into a bit of a snag.  The app is intended to allow users of our system to create a Word document, save it as XML, and then load it into the AIR app and have some manipulation performed to extract data, and finally store the data in a database.  The reasons for this app to exist are pretty irrelevant for the particular problem that I'm having, but a little background on my development efforts might help shed light on my situation, and with luck one of you might be able to help me figure this out.
    I started on this app using the URLLoader and URLRequest objects to load a Word document saved as XML from a server.  This worked fine, I created logic to distinguish between Word 2007 and Word 2003 XML formats and using the E4X XML and XMLList objects I was able to load that XML into an XML object, change it to a string, grab the document body, strip out namespaces and such (formatting is mostly irrelevant here too, only the actual data is of importance) amd eventually get a much simpler XML object or list that contained just the data relevant to the purpose at hand.  This was all working fine, I managed to get both Word XML formats to process as I wished and spit out new XML that will serve as the basis for another application that we run.  Great! 
    The problem was that in order to use this method in a distributed way I needed to have the original Word documents accessible to the code, which meant having the user upload their Word file (saved as XML) and then retrieving it with the URLLoader and URLRequest.  I actually implemented this method using the FileReference object in AS3 and using some simple PHP code to store the file in a server directory that was accessible to the client.  Unfortunately, this lead me to thinking about the security issues involved and how allowing PHP to write to a directory would open it to potential malicious attacks, yada yada yada, you all know the issues.  So I thought that I might be able to read the file before uploading it in the kind of circular logic that sometimes happens.  When I started into the AS3 docs to check on classes to help, I realized that my initial suspicions were correct and that in order to load and read the file locally, I could use AIR, have the user load up their XML file, process it and then send the resulting XML and info to the database directly (eliminating the need to send files to the server AND preventing the need to allow PHP to write to the server in this instance).
    So after a bit of reading and testing, I managed to modify my FLA to publish an AIR file, and started debugging.  My Word 2007 document worked fine - I create a File object and a FileStream object and they are easily able to access the file the user selects via the File.browseForOpen method.  I then run the processing code, which begins by creating an XML object from the data read from the file.  What's happening now is that while the Word 2007 document loads and processes without an issue, the Word 2003 document is causing a 1088 error: The markup in the document following the root element must be well-formed.
    I don't understand why this is happening since the same document in the same format was able to be loaded into an XML object when I used the URLLoader to grab the file.  The only thing I can conclude is that somehow the FileStream.readUTFBytes() method is somehow causing an issue.  I am able to trace out what is being read, but the file is lengthy and I haven't completed my analysis to see if and where the changes are occuring.
    If anyone has any experience with this type of situation, I'd really appreciate hearing about it.  Thanks in advance for any help you can provide.

    OK, it turns out that for some reason the Word 2003 XML document was being read with an extra character preceding the actual markup.  By dumping the stream into a string and then clipping the first character I was able to get the app running again.  Thanks for taking the time to read this thread! 

  • Conversion of FMB to XML problem

    Forms [32 Bit] Version 9.0.4.0.19 (Production)
    I am in the middle of a conversion project where we are converting fmb files to xml, making the required changes to the xml files using a conversion program, and then converting them back to fmb. When compiling the the fmb files, I noticed that there were compilation errors in a few of the forms. Checking original xml code for one of the forms that did not compile, it did not contain the trigger text for one of my post-change triggers. The block actually contains two items with the same identical post-change trigger. Only the trigger text for one of the items is written. The following shows the trigger for the "RECEIVED_TODAY" written properly, but the next item with the identical trigger does not have the trigger text:
    <Item Name="RECEIVED_TODAY" FontName="Arial" .... MaximumLength="10">
    <Trigger Name="POST-CHANGE"
    TriggerText=":in_po_detail.qty_received :=
    :in_po_detail.qty_received + nvl(:in_po_detail.received_today,0);
    &#10; &#10;get_due;" DirtyInfo="true" />
    </Item>
    <Item Name="RETURNED_TODAY" FontName="Arial" .... MaximumLength="10">
    <Trigger Name="POST-CHANGE" DirtyInfo="true" />
    </Item>
    If I delete and re-create the trigger for the item that is not written, it will write the corresponding xml out properly.
    Does anyone know why this is happening?

    Peter,
    sound strange and my guess is that this should be looked at by customer support. Is the Forms module originally build in Forms 9.0.4 or is it upgraded from a previous version of Forms?
    I found bug 2923866 that reports a similar case where the trigger was subclassed from a form or library. In this case the trigger text wasn't in the XML output and showed only if created in the Forms. Not sure if this is the same problem you are facing.
    Frank

Maybe you are looking for

  • Amount in words in F110 (sapscript -indian format)

    Hi Experts. I have changed the F110_PRENUM_CHCK to Z110_PRENUM_CHCK . I want the amount to be in word in indian format. say Ten Lakh ninty thousand and fifty But i am getting the output in "One millon .. " format Pls give me the coding and also sugge

  • Smartfomrs

    Hi, I am developing  SMARTFORM. i have created some standard text in so10 i want to call that particular text in a particular window. how can i call that standard text whixh i xreated in so10 ,in my smartform(for example header window)

  • Use of DBlookup API and find particular receiver

    Hi all, The scenario is : soap req -> XI -> req to external database -> resoponse from db to XI -> BAPI request -> response from BAPI to XI -> send response to SOAP Response I found that DBlookup API (User defined function to get data from External D

  • Please help...Slide show for funeral in jepoardy

    I know this isn't the iphoto or imovie forum, but the smartest brains live in this forum. You can send me to my room with no dinner for mis-posting, but I need some help ASAP...Tom, Ian, Al, Micheel, Piero, I need your A game... I seem to be having t

  • 'Undo Command' in Yosimite Mail

    Why is there no 'Undo' command under 'Edit' to 'Undo' accidental mail deletions in Mac Mail?