title: JSP Ajax Servlet - Get returned value in JSP
body: <p>I have two tables, and one of the tables is loaded when i click the first..
  So i use Ajax in my JSP for do it :</p>
  <pre><code>  $(&quot;#tablesorter-demo tr&quot;).click(function(){
          $('#tablesorter-demo tr').not(this).removeClass('hilite');
          $(this).toggleClass('hilite'); 
         
          $.ajax({
             type: &quot;post&quot;,
             url: &quot;gerer_cf_ad&quot;,
             data: &quot;name=test&quot;,
             success: function(data){
              
             }
           });
      });
  </code></pre>
  <p>In my JAVA :</p>
  <pre><code>protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      String  forward = &quot;/geCfAd/acc_getes.jsp&quot;;
       
      try {
          if(request.getParameter(&quot;name&quot;) != null){
              codeCentrale = &quot;5874&quot;;
              libelle = &quot;CApes&quot;;
              request.setAttribute(&quot;codeCentrale &quot;,codeCentrale );
              request.setAttribute(&quot;libelle&quot;,libelle);
                          }getServletContext().getRequestDispatcher(forward).forward(request, response);
      } catch (Exception e) {
          e.getMessage();
      }
  }
  </code></pre>
  <p>So, I want to get values : libelle and codeCentrale in my JSP for add it in may table but I  can't ..</p>
  <p>My table code  :</p>
  <pre><code> &lt;td id=&quot;td_codeCentrale SPCentrale&quot; &gt; &lt;% if(request.getAttribute(&quot;codeCentrale &quot;) != null){
                                                                                  out.print(request.getAttribute(&quot;codeCentrale &quot;));
                                                                              } %&gt;&lt;/td&gt;
                                      &lt;td id=&quot;td_libelleCentrale&quot; &gt;&lt;% if(request.getAttribute(&quot;libelle&quot;) !=null){
                                                                          out.print(request.getAttribute(&quot;libelle&quot;)); 
                                                                      }%&gt;&lt;/td&gt;
              
      
  </code></pre>