title: Best Way to include javascript in java servlets
body: <p>i actually read a tutorial about servlets and i saw two different ways to include javascript in servlets.</p>
  
  <pre><code>  out.println("&lt;html&gt;&lt;head&gt;");
  
    RequestDispatcher dispatcher = request.getRequestDispatcher(
        "/WEB-INF/javascript/functions.js");
  
    dispatcher.include(request, response);
  
    out.println("&lt;title&gt;Client Forms&lt;/title&gt;&lt;/head&gt;&lt;body&gt;");
  </code></pre>
  
  <p>and the other possiblity:</p>
  
  <pre><code>out.println("&lt;html&gt;&lt;head&gt;");
  out.println("&lt;script language="text/javascript" src="functions.js"&gt;");
  ...
  </code></pre>
  
  <p>what is the difference between using an dispatcher or including directly? what is the better solution?</p>
  
  <p>thx for your advices..</p>