Link to home
Create AccountLog in
Avatar of paddyfitz2005
paddyfitz2005

asked on

output a jsp page from a servlet


i'm trying to output a jsp page from a servlet but it won't display properly, anyone any ideas how i can display it as a jsp:
This is the code in the servlet


response.setContentType("text/html");
out.println("<%@ taglib prefix='c' uri='http://java.sun.com/jstl/core_rt' %>");
out.println("<%@ page contentType='text/html; charset=iso-8859-1' language='java' import='java.sql.*' errorPage='' %>");
out.println("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>");


out.println("<html xmlns='http://www.w3.org/1999/xhtml'>");
out.println("<HEAD>");
out.println("<TITLE>JFreeChart Servlet Demo 2</TITLE>");
out.println("</HEAD>");
out.println("<BODY>");
out.println("<%@ include file='/chart1.jspf'%>");

out.println("<H2>JFreeChart Servlet Demo</H2>");
out.println("<P>");
out.println("Please choose a chart type:");
out.println("<FORM ACTION=\"ServletDemo2\" METHOD=POST>");
String pieChecked = (param.equals("pie") ? " CHECKED" : "");
String barChecked = (param.equals("bar") ? " CHECKED" : "");
String timeChecked = (param.equals("time") ? " CHECKED" : "");
out.println("<INPUT TYPE=\"radio\" NAME=\"chart\" VALUE=\"pie\"" + pieChecked
+ "> Pie Chart");
out.println("<INPUT TYPE=\"radio\" NAME=\"chart\" VALUE=\"bar\"" + barChecked
+ "> Bar Chart");
out.println("<INPUT TYPE=\"radio\" NAME=\"chart\" VALUE=\"time\"" + timeChecked
+ "> Time Series Chart");
out.println("<P>");
out.println("<INPUT TYPE=\"submit\" VALUE=\"Generate Chart\">");
out.println("</FORM>");
out.println("<P>");
out.println("<IMG SRC=\"ServletDemo2ChartGenerator?type=" + param
+ "\" BORDER=1 WIDTH=400 HEIGHT=300/>");
out.println("<%@ include file='/chart2.jspf'%>");
out.println("</BODY>");
out.println("</HTML>");
ASKER CERTIFIED SOLUTION
Avatar of evnafets
evnafets

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Avatar of Siva Prasanna Kumar
Siva Prasanna Kumar
Flag of India image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.