Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
256
Chapter 11 The JSP page Directive: Structuring Generated Servlets
Listing 11.4 shows a page that uses this approach; Figures 11 7 and 11 8
show the results in Internet Explorer. Again, in a real application the data
would almost certainly be dynamically generated. For example, see Section
18.3 (Some JDBC Utilities) for some very simple methods to create an HTML
table (usable in HTML or as an Excel spreadsheet) from a database query.
Listing 11.4 ApplesAndOranges.jsp 
Comparing Apples and Oranges
      HREF="JSP Styles.css"
      TYPE="text/css">

Comparing Apples and Oranges

<% 
String format = request.getParameter("format");
if ((format != null) && (format.equals("excel"))) { 
  response.setContentType("application/vnd.ms excel");
}  
%>
  
ApplesOranges
  
First Quarter23074706
  
Second Quarter29825104
  
Third Quarter30115220
  
Fourth Quarter30555287
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

jsp web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Jsp Web Hosting Cheapest Web Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved