/github.com/qrtt1/tut_web pure jdbc lab https:/ /github.com/qrtt1/tut.TodoJdbc jdbc + dbcp + dbutils https:/ /github.com/qrtt1/tut.TodoDao todo web in model 1 https:/ /github.com/qrtt1/tut.TodoJspWeb todo web in model 2 https:/ /github.com/qrtt1/tut.TodoModel2Web
server parsing HTTP Request to ENVIRONMENT variable redirect HTTP Request body to STDIN dispatch depends on URI CGI Application #!/usr/bin/perl print "Content-type:text/html\r\n\r\n"; print '<html>'; print '<head>'; print '<title>Hello Word - First CGI Program</title>'; print '</head>'; print '<body>'; print '<h2>Hello Word! This is my first CGI program</h2>'; print '</body>'; print '</html>'; 1; HTTP RESPONSE Generate HTTP Response to STDOUT CGI is a language-free-method
server parsing HTTP Request to XXX language variable (defined like CGI does) redirect HTTP Request body to STDIN dispatch depends on URI Other Server Side Programming Language def simple_app(environ, start_response): """Simplest possible application object""" status = '200 OK' response_headers = [('Content-type','text/plain')] start_response(status, response_headers) return ['Hello world!\n'] HTTP RESPONSE Generate HTTP Response by OUTPUT method (In this case, it is a callable object start_response and return the content)
web server parsing HTTP Request to HttpServletRequest object dispatch depends on Servlet URI mapping (defined in web.xml, also in annotation after servlet 3.0) Java Servlet public class HelloServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.getWriter().write("<html><body>"); resp.getWriter().write("Hello Servlet"); resp.getWriter().write("</body></html>"); } } HTTP RESPONSE Generate HTTP Response by HttpServletResponse object
can transform the content of HTTP requests, responses, and header information. Filters do not generally create a response or respond to a request as servlets do, rather they modify or adapt the requests for a resource, and modify or adapt responses from a resource.
include directive @page for http header settings @taglib for jstl declaration @include for assemble page fragments EL to show variables Business Logic is not my business.
(Servlet) Prepare View (JSP) HttpServletRequest HttpServletResponse HTTP RESPONSE Business Object set up data to {application, session, request, ...} show data from {application, session, request, ...}