title: Defining a class in a JSP
body: <p>Please don't punch me in the face! I know this flies in the face of good design, but I'm simply writing a test page to demonstrate something. Our webapp module (correctly) has no direct access to our domain classes. I don't want to create a whole class outside of the JSP, since the page is just for demonstration purposes, and I don't want to write a lot of extraneous code for the same reason. I was trying to define a class the usual way in the JSP, but that didn't work (threw a lot of compile-time errors). This is a quick-n-dirty, one-time deal (I'll be getting rid of it once I'm done). I'd just like to know if this is possible or not. If not, then I will go the long way.</p>
  
  <pre><code>&lt;%
  
   public class Person {
      private int id;
      private int age;
      private String name;
  
      /*
        ... ctor and getters and setters
      */
  
   }
  %&gt;
  </code></pre>
  
  <p>And the errors I got:</p>
  
  <pre><code>convert-jsp-to-java:
  [INFO] ------------------------------------------------------------------------
  [ERROR] BUILD ERROR
  [INFO] ------------------------------------------------------------------------
  
  An error occurred at line: 57 in the generated java file
  Syntax error on token "class", invalid VariableDeclarator
  
  An error occurred at line: 73 in the generated java file
  The return type is incompatible with Object.getClass()
  
  An error occurred at line: 74 in the generated java file
  Syntax error on token "class", Identifier expected
  
  An error occurred at line: 77 in the generated java file
  Syntax error on token "class", invalid VariableDeclaratorId
  
  An error occurred at line: 78 in the generated java file
  Syntax error on token "this", PrimitiveType expected
  
  An error occurred at line: 78 in the generated java file
  Syntax error on token "class", invalid Expression
  
  An error occurred at line: 79 in the generated java file
  Syntax error on token "class", invalid Expression
  </code></pre>