title: HTML tags inside user defined function in JSP without using out.println
body: <p>I have a method containing html tags and simple statements in JSP. I have made exclamation mark(!) before each statement. After deploying jsp in server, I checked jsp file and found that By doing this( using '!' sign ), My all statements remain in the same function and html goes in Service() method of jsp what is not desired at all. out.println() is an option for that but I donot want to use out.println() method for writing html beacuse it is equivalent to writing html in servlet.</p>
  
  <p>JSP page after deployment:</p>
  
  <pre><code>public final class DynamicGUI
  {
      // This is where the request comes in
       public void _jspService(HttpServletRequest request, HttpServletResponse response) 
          throws IOException, ServletException
       {
          JspWriter out = ...; 
  
      out.write("&lt;html&gt;");
      out.write("&lt;head/&gt;");
      out.write("&lt;body&gt;");
      out.write(printelements()); // i.e. write the results of the method call
      out.write("&lt;/body&gt;");
      out.write("&lt;/html&gt;");
  }
  
  // my method
  
  private String printelements()
  {
      // code stays here 
      but html tags goes into service(). I want them to be here
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Is there any alternative to do same thing?</p>
  
  <p>Thanks for help</p>