Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using JSP with servlets

 
Chris Patton
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is exactly what the <jsp:include> tag is for:

or if you need to pass parameters in:

Give it a try.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic