• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to dynamically convert XML to HTML using JSP?

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a problem.
I can search an account using a servlet and a jsp file,
and show the results using XML.
Now I need to minitor those output and show it using HTML.
I run the following jsp, but got error:
<%@taglib uri="http://jakarta.apache.org/taglibs/xsl-1.0" prefix="xslt" %>
<html>
<head>
<title>Account Monitor</title>
</head>
<body>
<center>
Minitor
<p></p>
<xslt:apply xml="http://localhost/servlet/acctMonitor?acctKey=1234678&branch=BIC" xsl="bic.xsl"/>
</center>
</body>
</html>

What's wrong?
Thanks in advance.

Exception in jsp:
org.apache.jasper.JasperException: Could not locate TLD META-INF/taglib.tld at
org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:217) at
org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEventListener.java:648) at
org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingListener.java:110) at
org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:194) at
org.apache.jasper.compiler.Parser.parse(Parser.java:984) at
org.apache.jasper.compiler.Parser.parse(Parser.java:959) at
org.apache.jasper.compiler.Parser.parse(Parser.java:955) at
org.apache.jasper.compiler.Compiler.compile(Compiler.java:140) at
org.apache.jasper.runtime.JspLoader.loadJSP(JspLoader.java:226) at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:142) at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:153) at
org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:245) at
org.apache.jasper.runtime.JspServlet.service(JspServlet.java:350) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:868) at
com.gefionsoftware.server.ServletContextImpl$ServletHandler.call(ServletContextImpl.java) at
com.gefionsoftware.server.ServletContextImpl.executeServlet(ServletContextImpl.java) at
com.gefionsoftware.server.ServletContextImpl.execute(ServletContextImpl.java) at
com.gefionsoftware.server.GenericServer.execute(GenericServer.java) at
com.gefionsoftware.server.lws.LiteWebServer$RequestHandler.run(LiteWebServer.java) at
se.pureit.util.ThreadPool$WorkThread.startRunnable(ThreadPool.java) at
se.pureit.util.ThreadPool$WorkThread.run(ThreadPool.java)
 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I've been doing this sort of stuff recently and because its pretty hard and there is a lot that can go wrong, I made a really simple standalone app so that I can be sure that i have the code correct, but also so that i can check the xslt is valid and see the output. The whole thing is less than 40 lines of cose - TOPS
Its essentially a tactic i use all the time - seperate the various parts and test them ina very simple and isolated environment to identify the problem.
If you would find that code helpful, just let me know and I'll post it here for you

Simon
 
Faxin Zhao
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Simon,
Thanks for your reply.
Yes, please post your code here.
 
Faxin Zhao
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anybody can help me?
 
Simon Harvey
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there my friend,
I am really really sorry. I forgot about your post because i couldnt see it. I only just noticed it again. I deleted my actual source code for what you are looking for but I found the following for you. It demonstrates just how EASY it is to do a transform. What I suggest, is that you make a really simple standalone application that takes two parameters, the file names of the xml and xsl documents and then outputs the result to a text file.
Alternatively, you could ammend the jsp page that I am posting here and have the html displayed in the browser. That would be the better but slightly harder option. You would get to see if your html is valid though
I really hope this helps.Sorry no-one else replied. Remember though, there is a specific xml/xsl forum and this question was only loosely related to jsp.
Simon
 
Simon Harvey
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I should have added that the above code was taken from the Wrox book Beginning Java Databases (Chapter 21)
Thanks
Simon
 
reply
    Bookmark Topic Watch Topic
  • New Topic