title: Purpose of closing html and body tags in Jsp page
body: <p>I have very basic question on Jsp and HTML and the below example is from Java EE7 black book.</p>
  
  <p>Login.html</p>
  
  <pre><code>&lt;html&gt; 
  &lt;body&gt;
      &lt;pre&gt;
      &lt;form action="LoginProcess.jsp"&gt;
          &lt;b&gt;User Name&lt;/b&gt; : &lt;input type="text" name="uname"/&gt;
          &lt;b&gt;Password&lt;/b&gt;  : &lt;input type="password" name="pass"/&gt;
          &lt;input type="submit" value="LogIN"/&gt;
      &lt;/form&gt; 
      &lt;/pre&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Below is the code for JSp</p>
  
  <pre><code>&lt;%@page import="java.sql.*" errorPage="\MyError.jsp"%&gt;
  &lt;html&gt;
  &lt;body&gt;
      &lt;% 
      Connection con=null;
      String uname=request.getParameter("uname");
      String pass=request.getParameter("pass");
      try 
      {
          Class.forName("oracle.jdbc.driver.OracleDriver");
          con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.123:1521:XE","scott","tiger");
          Statement st=con.createStatement();
          ResultSet rs=st.executeQuery("select * from userdetails where uname='"+uname+ "' and pass='"+ pass +"'");
          if (!rs.next())
          {   
  
      %&gt;
  
      User details given for user name : &lt;%=request.getParameter("uname")%&gt; and 
      password : &lt;%=request.getParameter("pass")%&gt; are not valid &lt;br/&gt; Try again 
      &lt;%@include file="Login.html"%&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  &lt;% 
          return; 
      }//if
  }//try
  finally 
  {
      try
      {
          con.close();
      }catch(Exception e){}
  }//finally
  %&gt;
  
  This is a Home Page &lt;br/&gt;
  Welcome, &lt;%=uname%&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p>My question is regarding <code>&lt;/body&gt; &amp; &lt;/html&gt;</code> tags that hang in the middle of the code right above return statement [dont know how to highlight them in code]. I did not understand the purpose of those two tags. I got confused on why the html and body tags are closed. And How can further code is rendered after html tag is closed. Could someone please throw some light on this.</p>
  
  <p>Thanks in advance .</p>