title: Why do I get null pointer exception: null when getting value from view with form url encoded?
body: <p>I am coding in Java/html-scala in the Play framework. </p>
  
  <p>I am trying to get a value from my view using form url encoded but all I get is null pointer exception.
  In my controller, I do:</p>
  
  <pre><code>String[] searchTag= request().body().asFormUrlEncoded().get("questionTag"); //this is where I get my null pointer exception
  //questionTag is the name of my input field in the view
  </code></pre>
  
  <p>In my view:
  At the top of my view, I have:</p>
  
  <pre><code>@helper.form(action=routes.TeacherController.ValidateQuestion(), 'enctype -&gt; "multipart/form-data", 'class -&gt; "form-horizontal") {... //rest of my code
  </code></pre>
  
  <p>my input field:</p>
  
  <pre><code>&lt;input name="questionTag" class="input-xxlarge"&gt;
  </code></pre>
  
  <p>In the same view, I allow the user to upload a file and I get that file in the same function in the controller with:</p>
  
  <pre><code>Http:MultipartFormData body = request().body().asMultipartFormData();
  Http.MultipartFormData.FilePart attachment = body.getFile("attachment");
  </code></pre>
  
  <p>I was wondering if that might be causing this exception, that I can not get data with both kinds of methods (multipart/form-data and <code>asFormUrlEncoded().get("questionTag"))</code> in the same view?</p>