Blonde Guy

JavaServer Pages

JavaServer Pages (jsp) are a way to combine the power of java on the server with the flexibility of HTML for page layout. They work by embedding java code in the web page. When the JSP enabled web server gets a request for a file ending in jsp, it compiles the java and runs it to fill out the page source, then it serves the resulting page.

WebSphere 1.1 has a bug in which a JavaServer Page that needs recompiling will cause an internal server error. If a JavaServer Page needs to be recompiled, the best thing to do is stop, then restart the web server. This bug is fixed in WebSphere 3.0

This page is an example

This page is a JavaServer Page. Your browser made the request, and the server ran the compiled version of this page. To create the next section, the following items were retrieved from the HttpServletRequest object and output as page text.

<% Enumeration hdrNames; String hdrName; String hdrValue; String[] vars = {"", ""}; /* put the request header names into an Enumeration of strings */ hdrNames = request.getHeaderNames(); /* loop through name Enumeration, get matching value, and print name/value pair */ while(hdrNames.hasMoreElements()) { /* get the next name from the Enumeration of parameters */ hdrName = (String)hdrNames.nextElement(); vars[0] = hdrName; /* get the value of the parameter */ hdrValue = (String)request.getHeader(hdrName); vars[1] = hdrValue; /* print the name/value pair to the browser */ out.println(""); } %>
Property NameValue
" + vars[0] + "" + vars[1] + "

Last Modified: 30 Oct 2000
Graphics by Colorful Language
Copyright 2000 by Blonde Guy