Ron Ben-Natan wrote:

> Hi,
>
> Is it possible to use the JSP engine in a mode that is disconnected
> from an HTTP session? The JSP mechanism seems a great way to separate
> templates from code for formating purposes. For example, if I need to
> create a letter to a customer it only makes sense to place the letter
> in a JSP and pass it some objects to extract the customer name, address
> etc. from. The question is whether I must call this thing using an HTTP
> connection (which is very inconvenient and seems a performance problem)

Inconvenient how?  Using a URLConnection in your application to contact a web
server that serves the JSP for you is pretty easy.

How much is performance an issue?  For your example case (filling out a form
letter) I hardly think you'll be able to count the number of milliseconds
required.


>
> or is there a way for me to create a fictitious request and response
> and activate this as a Java program? (i.e. I have a Java program that
> has all the objects - I want to call the JSP to prepare the output stream
> and then extract the generated string from that call.
>
> Is this possible, and if so can someone forward me to some sample code that
> does this?
>

It is certainly possible, but you essentially need to simulate a servlet engine
(and the JSP page compiler) for this to work.  If you are serious about not using
JSP pages the way they were designed (in a servlet-enabled web server
environment), then you probably want to look at other template-based solutions
that deal directly with files but allow embedded processing to pick up the data
items.  (Or, for merge letters, there's always a word processor :-).

>
> Thanks,
> -Ron
> ([EMAIL PROTECTED])
>

Craig McClanahan

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to