Discussions

Web tier: servlets, JSP, Web frameworks: JSP, JSTL XML parsing and XSLT processing

  1. JSP, JSTL XML parsing and XSLT processing (1 messages)

    Our purpose is to parse an XML document and create a DOM object when the JSP is loaded for the first time in the application and store the DOM object in application scope.

    When the JSP is hit the next time, the DOM object stored in application scope needs to accessed and we need to process the same using X Tags.

    The problem we are facing is, we are not able to access the DOM object stored in application scope.

    Code Snippet

    this code creates a DOM object and stores the same in application scope in attribute configdom.

    <% if (application.getAttribute("configobj")==null)
       { %>
          <xtags:parse id="configDom" uri="config/Config.xml" />
              <% application.setAttribute("configobj",configDom);
              } %>

    --Code below wants to process the DOM using xtags.

    <xtags:forEach select="//config/scode" context="<%=(org.dom4j.tree.DefaultDocument)application.getAttribute("configobj")%>" >
              <xtags:valueOf select="@appid" />
    </xtags:forEach>

    I feel there is some issue with the context attribute above,
    Can someone please let us know what is wrong.

    Thanks

    Threaded Messages (1)

  2. Yet another DOM[ Go to top ]

    Check out DOM taglib in Coldtags suite:
    http://www.servletsuite.com/jsp.htm