title: Accessing Request object from custom JSP tags
body: <p>I'm trying to make a set of custom tags that encapsulate form elements (markup and validation).</p>
  
  <p>There's a method given to retrieve the "Out" object easily:</p>
  
  <pre><code>JspWriter out = getJspContext().getOut();
  </code></pre>
  
  <p>However I can't figure out how to get the request object. I want to be able to directly access the submitted form values from within the Tag class so that I can validate each field.</p>
  
  <p>The <a href="http://tomcat.apache.org/tomcat-5.5-doc/jspapi/javax/servlet/jsp/tagext/SimpleTagSupport.html" rel="noreferrer">documentation</a> is quite sparse, so I thought maybe I could use the <a href="http://tomcat.apache.org/tomcat-5.5-doc/jspapi/javax/servlet/jsp/JspContext.html" rel="noreferrer">JspContext</a> object to somehow get the request attributes. But I don't understand the different scopes.</p>
  
  <pre><code>System.out.println(getJspContext().findAttribute("field1"));
  </code></pre>
  
  <p>always prints "null".</p>
  
  <pre><code>Enumeration e = getJspContext().getAttributeNamesInScope(1);
  </code></pre>
  
  <p>Looping through and printing out the enumeration just gives me a list of classes that don't exist:</p>
  
  <pre><code>javax.servlet.jsp.jspOut
  javax.servlet.jsp.jspPage
  javax.servlet.jsp.jspSession
  javax.servlet.jsp.jspApplication
  javax.servlet.jsp.jspPageContext
  javax.servlet.jsp.jspConfig
  javax.servlet.jsp.jspResponse
  javax.servlet.jsp.jspRequest
  </code></pre>
  
  <p>So is this even possible?</p>
  
  <p>If not, could anyone point me to a tag library that deals with form display and validation? I searched the internet for a couple hours and it seemed every single one was discontinued and I couldn't download them. Either that or suggest a better alternative for handling forms.</p>
  
  <p>Edit: The tags extend the <code>SimpleTagSupport</code> class.</p>