title: How to set value in c:set attribute in jsp
body: <p>Can you advise me how to set value of my <code>c:set</code>.</p>
  
  <p>I'm trying to set the value of <code>item[0]</code> to a bean property <code>id</code> in <code>TransactionAction</code> and send it to the controller class.</p>
  
  <p>It gives me null when I print this value in controller class. However I'm able to view the value inside this JSP.</p>
  
  <p>
  
              </p>
  
  <pre><code>            &lt;table&gt;
  
                  &lt;tr&gt;&lt;th&gt;ID&lt;/th&gt;
                      &lt;th&gt;LOGIN ID&lt;/th&gt;
                      &lt;th&gt;LAST UPDATE BY&lt;/th&gt;
                      &lt;th&gt;TRANSACTION TYPE&lt;/th&gt;
                      &lt;th&gt;STATUS&lt;/th&gt;
                  &lt;/tr&gt;    
                  &lt;c:forEach var="item" items="${ToDoList}"&gt;
                      &lt;tr&gt;
                          &lt;td&gt;${item[0]}&lt;/td&gt;
                          &lt;td&gt;${item[1]}&lt;/td&gt;
                          &lt;td&gt;${item[2]}&lt;/td&gt;
                          &lt;td&gt;${item[3]}&lt;/td&gt;   
                          &lt;td&gt;${item[4]}&lt;td&gt;
  
                          &lt;td&gt;
                              &lt;c:set value = "item[0]" target="${transactionAction}" property="id" /&gt;
  
                              &lt;form:select path="action" tabindex="50"&gt;
  
                          &lt;form:option value="----------Please select---------" /&gt;
                          &lt;form:option value="APPROVE" label="APPROVE" /&gt;
                          &lt;form:option value="REJECT" label="REJECT"/&gt; 
              &lt;/li&gt;
          &lt;/form:select&gt;
                      &lt;/tr&gt;
                  &lt;/c:forEach&gt;
  
              &lt;/table&gt;
  
          &lt;/c:if&gt;
  &lt;input type="submit" value="Submit"&gt; 
  
      &lt;/form:form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Controller class to send the value of ToDoList to the above JSP</p>
  
  <pre><code>  public String adduser(LoginForm request,ModelMap map1) throws Exception {
      String currentUser = sessionUser.getUserName();
      System.out.println("========add user model ============================="+sessionUser.getUserName());
      String result = loginservice.adduser(request);
      List trx = loginservice.trxdetail(currentUser);
      map1.addAttribute("user", sessionUser.getUserName());
      map1.addAttribute("dateTime", sessionscopebillingdata.getDate());
      System.out.println("username from the controller class " + sessionUser.getUserName());        
      map1.addAttribute("ToDoList", trx);   
      map1.addAttribute("action",new TransactionAction());
      return "UserToDoList";
  }
  </code></pre>
  
  <p>Below is my method to get the values from database using hibernate</p>
  
  <pre><code>public List trxdetail(String userName) {
      Session session = sessionFactory.getCurrentSession();
      Query query;
      query = session.getNamedQuery("Loginuser.findApprover");
      query.setString("loginId", userName.toUpperCase());
      Long ownerId = (Long) query.uniqueResult();
      Query qry = session.createQuery("select lu.id,lu.loginId,lu.lastUpdateBy,trx.transactionType,trx.status from Loginuser lu , BillingSolutionTrx trx where lu.id = ref_id and owner_Trx_Id='" + ownerId + "'");
      BillingSolutionTrx transactionDetail = new BillingSolutionTrx();
      List transactionList = qry.list();
  
  
      return transactionList;
  } 
  </code></pre>