aspose file tools*
The moose likes JSP and the fly likes JSP pages (content: XML) cannot be access by multiple process? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP pages (content: XML) cannot be access by multiple process?" Watch "JSP pages (content: XML) cannot be access by multiple process?" New topic
Author

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

Rudy Rusli
Ranch Hand

Joined: Jun 01, 2006
Posts: 114
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

Joined: Jan 10, 2002
Posts: 61424
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rudy Rusli
Ranch Hand

Joined: Jun 01, 2006
Posts: 114
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

Joined: Jan 10, 2002
Posts: 61424
    
  67

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?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JSP pages (content: XML) cannot be access by multiple process?