Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP pages (content: XML) cannot be access by multiple process?

 
Rudy Rusli
Ranch Hand
Posts: 114
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is continuation of my thread on:
http://www.coderanch.com/t/381266/java/java/Looking-efficient-way-do-data

Basically I'm looking for the most efficient way to do data delivery to clients. Basically I need to provide data to clients in XML format every time the they access a URL.
The XML data will be created based on data on a table.

I'm comparing between two approaches:
1. Create a file every time clients request it. And then redirect clients to this file.
2. "Creating on-the-fly approach"

I'm testing #2 using a JSP page that have out.print() statements to generate the XML. I create a small XML parser. Everything is okay with one process running. Then I try to simultaneously access the JSP page using multiple process and it gives me an error many times saying that the XML feed is not properly formatted (fatal error message).

Is it because there's only one instance of that JSP page exist? So there cannot be multiple processes?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Each instance of a JSP will run in its own thread. if there is a threading issue, it will be in your own code.

That said, why on earth bother to use a JSP if you're going to use out,print() statements? The whole point of JSP is that template text and output is easy to emit without resorting to that.
 
Rudy Rusli
Ranch Hand
Posts: 114
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.

Could you please explain me more about this?
> That said, why on earth bother to use a JSP if you're going to use
> out,print() statements? The whole point of JSP is that template text and > output is easy to emit without resorting to that.

Thanks again.
- Rudy -
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a JSP, if you wanted to emit the string "Toto, too?", you could do it in template text:

Toto, too?

or as part of a scriptlet:

<%
out.print("Toto, too?");
%>

The latter makes no sense.

If you're using JSP 2.0, it's even a larger breach of principles as scriptlets themselves are no longer preferred in favor of the EL and JSTL.

If you're doing this in Java, why a clunky JSP rather than a servlet?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic