title: Capture the value of JSP Expression Language variable into a java variable
body: <p>is it possible to capture the value of JSP Expression Language variable into a java variable in a jsp page?</p>
  
  <p>Eg: I have a variable ${error.type} and i want to capture the value of ${error.type} into a java variable, say something like this: <code>String errortype = ${error.type}</code> (I know this isn't possible) Is there anyway for doing this?
  Actually I want to check if <code>${error.type}</code> is null or not, if there is any value available I will show success message else an error message.
  Thanks I'm new to java and JSP :)</p>
  
  <hr>
  
  <p>Update:
  I tried this code</p>
  
  <pre><code> &lt;c:choose&gt;
       &lt;c:when test="${not empty error.type}"&gt; 
          test error message    
       &lt;/c:when&gt;     
       &lt;c:when test="${empty error.type}"&gt;
           test success message     
       &lt;/c:when&gt; 
   &lt;/c:choose&gt; 
  </code></pre>
  
  <p>But now both the text are displayed simultaneously irrespective of empty or not! 
  Even i tried <code>${errors.errors ? "some text when true" : "some text when false"}</code> and guess what, every time i'm getting "some text when false" printed in browser though the value is getting initialized correctly. any idea why? </p>