This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Using JSP with servlets" Watch "Using JSP with servlets" New topic
Author

Using JSP with servlets

Chris Patton
Greenhorn

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.

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

Joined: Jan 30, 2000
Posts: 3222
    
    5
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
Sheriff

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 frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
 
subject: Using JSP with servlets
 
Similar Threads
FOR HELP: Failed to connect to oracle in servlet
Good SF titles/writers
STRUTS - Invalid path
JSP's and Servlet newbie
algorithms, data structures