JSP/Servlet Correspondence
Original JSP

A Random Number

<%= Math.random() %>
Possible resulting servlet code
public void _jspService(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
request.setContentType("text/html");
HttpSession session = request.getSession(true);
JspWriter out = response.getWriter();
out.println("

A Random Number

");
out.println(Math.random());
...
}
23
JSP
www.corewebprogramming.com
Example Using JSP 
Expressions

JSP Expressions

  • Current time:
  • <%= new java.util.Date() %>
  • Your hostname:
  • <%= request.getRemoteHost() %>
  • Your session ID:
  • <%= session.getId() %>
  • The testParam form parameter:
  • <%= request.getParameter("testParam") %>
    24
    JSP
    www.corewebprogramming.com
    12
    
    
    
    
      

    Home

    About Services Network Support FAQ Order Contact
     

    Java Web Hosting

    Our partners:Jsp Web Hosting Unlimited Web Hosting Cheapest Web Hosting  Java Web Hosting Web Templates Best Web Templates PHP Mysql Web Hosting Interland Web Hosting Cheap Web Hosting PHP Web Hosting Tomcat Web Hosting Quality Web Hosting Best Web Hosting  Mac Web Hosting 

    Lunarwebhost.net  Business web hosting division of Vision Web Hosting Inc. All rights reserved