40 likes | 206 Views
XFP. XML Framework Page. Current technologies. Java Servlets: Java files that generate character streams JSP: character streams with embedded Java XSP: XML files with embedded Java. import java.io.*; import javax.servlet.*; import javax.servlet.http.*;
E N D
XFP XML Framework Page
Current technologies • Java Servlets: Java files that generate character streams • JSP: character streams with embedded Java • XSP: XML files with embedded Java
import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class HelloWorldServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { PrintWriter out = res.getWriter(); out.println("Hello, world."); out.close(); } } A basic servlet
… res.setContentType("text/html; charset=utf-8"); PrintWriter out = res.getWriter(); out.println("<html>"); out.println(" <head>"); out.println(" <title>HTML example</title>"); out.println(" </head>"); out.println(" <body>"); out.println(" <h1>HTML example</h1>"); out.println(" <p>This is an example of"); out.println(" <a href=\"http://www.w3.org/TR/xhtml1/\">HTML</a>."); out.println(" </body>"); out.println("</html>"); … Slightly more unwieldy example