Meaningless Drivel is fun!
The moose likes Servlets and the fly likes Using JSP with servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Using JSP with servlets" Watch "Using JSP with servlets" New topic

Using JSP with servlets

Chris Patton

Joined: Jun 12, 2000
Posts: 7
Is there any way to embed the return (via the PrintWriter) from a servlet into a web page?
More specifically, I'd like to be able to mimic the Server-Side include command #exec.
I have tried using #exec with the servlet but it doesn't work.

- Chris
[This message has been edited by Chris Patton (edited August 17, 2000).]
Tony Alicea

Joined: Jan 30, 2000
Posts: 3226
I would have the servlet create a JavaBean with the results and place it in the HttpSession object. Then a JSP page would use a <jsp:useBean> tag and corresponding <%=bean.getThis()%> expressions to produce the desired results...

Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
This is exactly what the <jsp:include> tag is for:

or if you need to pass parameters in:

Give it a try.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
I agree. Here's the link:
subject: Using JSP with servlets
It's not a secret anymore!