Suppose I have some form like this
<form action="/add_scores" method="post" enctype="multipart/form-data" id="add_link_form">
    <input type="text" name="subject" id="subject" placeholder="subject">
    <input type="text" name="link" id="link">
    <button type="submit" class="btn btn-success">Add</button>
</form>
And in my servlet
@Override
public void doPost(HttpServletRequest req, HttpServletResponse res)
        throws ServletException, IOException {
    String subject = (String)req.getAttribute("subject");
    String link = (String)req.getAttribute("link");
}
subject and link are always null when I post something. But if I use method="get" in form and rename doPost to doGet this code works fine and subject and link are good. (Also this happens if I change getAttribute() to getParameter()).
Why is this happening and how can I get my values in doPost?
 
     
     
    