title: add annotation to JSP
body: <p>so in my class i was ordered to upload images to database and get them out and show them on a website, pretty simple when using servlet or php, but i was asked to do it using only JSP files. to do so i had to get an image from the user and pass it as a parameter and get a part of the parameter, not a problem. </p>
  
  <p>the problem started when i tried to run it and the server asked for @multipartconfig annotation. i cant find a way to add it to the jsp code.</p>
  
  <h2>this is the jsp:</h2>
  
  <pre><code>    &lt;%@page import="javax.servlet.annotation.MultipartConfig"%&gt;
  &lt;%@page import="java.sql.*"%&gt;
  &lt;%@page import="java.io.InputStream"%&gt;
  &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  
  
  &lt;%
      request.setCharacterEncoding("UTF-8");
      Part p = request.getPart("image");
      InputStream inputStream = null;
      if (p != null) {
          inputStream = p.getInputStream();
      }
  
      String driver = "com.mysql.jdbc.Driver";
      String url = "jdbc:mysql://localhost:3306/test42";
      Class.forName(driver);
      Connection con = DriverManager.getConnection(url, "root", "1234");
  
      String sqlString = "INSERT INTO test42.images items(idimages) values(" + inputStream + ");";
  
      String msg = p.toString();
  
  %&gt;
  </code></pre>
  
  <h2>this is the upload form:</h2>
  
  <pre><code>  &lt;form method="post" action="mainPage.jsp" enctype="multipart/form-data"&gt;
                  choose file :
                  &lt;input type="file" name="image" /&gt;
  
                  &lt;input type="submit" value="submit"&gt;
              &lt;/form&gt;
  </code></pre>
  
  <p>and this is the messege from the server: </p>
  
  <pre><code>java.lang.IllegalStateException: Request.getPart is called without multipart configuration. Either add a @MultipartConfig to the servlet, or a multipart-config element to web.xml
  </code></pre>
  
  <p>i tried adding it to the web.xml but it didnt work....
  the app just crash with a build error;
  i got this solution from here:
  <a href="http://docs.oracle.com/javaee/6/tutorial/doc/gmhal.html" rel="nofollow">http://docs.oracle.com/javaee/6/tutorial/doc/gmhal.html</a></p>
  
  <h2>  like so:</h2>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"&gt;
  
      &lt;session-config&gt;
          &lt;session-timeout&gt;
              30
          &lt;/session-timeout&gt;
     &lt;/session-config&gt;
  
     &lt;multipart-config&gt;
      &lt;location&gt;/tmp&lt;/location&gt;
      &lt;max-file-size&gt;20848820&lt;/max-file-size&gt;
      &lt;max-request-size&gt;418018841&lt;/max-request-size&gt;
      &lt;file-size-threshold&gt;1048576&lt;/file-size-threshold&gt;
  &lt;/multipart-config&gt;
  
  &lt;/web-app&gt;
  </code></pre>