title: Pass value of href from JSP to Servlet
body: <blockquote>
    <p>I am working on <strong>Java EE application</strong> where I want to pass my <strong>selected href
    value from JSP to a Servlet</strong>. I have 5 links from which i want to pass
    selected value.</p>
    
    <p>My <strong>jsp code</strong> is,</p>
  </blockquote>
  
  <pre><code>&lt;a href="selectTopic" name="html"&gt;HTML 5&lt;/a&gt;&lt;br /&gt;
                  &lt;a href="selectTopic" name="windows"&gt;Windows 8&lt;/a&gt;&lt;br /&gt;
                  &lt;a href="selectTopic" name="office"&gt;MS Office 2013&lt;/a&gt;&lt;br /&gt;
                  &lt;a href="selectTopic" name="android"&gt;Android&lt;/a&gt;&lt;br /&gt;
                  &lt;a href="selectTopic" name="hadoop"&gt;Hadoop&lt;/a&gt;
  </code></pre>
  
  <blockquote>
    <p>which look like this</p>
  </blockquote>
  
  <p><img src="https://i.stack.imgur.com/ePaDd.png" alt="enter image description here"></p>
  
  <blockquote>
    <p>I have mapped my selectTopic action to the <strong>SelectedTopic.java</strong> servlet
    class. code is,</p>
  </blockquote>
  
  <pre><code>protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  
          String selectedTopic = "";
  
          selectedTopic = (String)request.getParameter("html");
  
          System.out.println("selectedTopic = "+selectedTopic);
  
      }
  </code></pre>
  
  <blockquote>
    <p>and the <strong>output</strong> is:</p>
  </blockquote>
  
  <pre><code>selectedTopic = null
  </code></pre>
  
  <blockquote>
    <p>My question is,</p>
    
    <p>1)Why i am getting null value as i have taken same as we are getting
    value from any textfield<br>
    2)How can i dynamically differentiate and
    take selected link name (html or windows or android etc) on
    SelectedTopic.java</p>
  </blockquote>