title: How to dynamically assign value to Struts 2 textfield from Map
body: <p>I am trying to dynamically assign value to Struts2 textfield for that what i am doing id user Administrator is asked with a <code>userId</code> when he enters that Id that id is checked in DB if that id exists and it belongs to class employee I am passing object of class employee in using code</p>
  
  <pre><code>Map m = ActionContext.getContext().getSession();
  m.put("userDATA",o);
  </code></pre>
  
  <p>Where o is a object of class employee then my action class returns <code>SUCCESS</code> and O am redirected to page where I am displaying properties of Employee like <code>fName</code>, <code>lName</code> etc. but I am really struck with assigning dynamic value in struts textfield what I am doing is</p>
  
  <pre><code>&lt;%Object o=session.getAttribute("userDATA");
  Employee e=(Employee)o%&gt;
  </code></pre>
  
  <p>and then I am doing </p>
  
  <pre><code>&lt;s:textfield label="First Name" name="fName" value="%{e.fName}"&gt;
  </code></pre>
  
  <p>but I am getting nothing and yet I have already done <code>&lt;%@taglib prefix="s" uri="/struts-tags"%&gt;</code></p>
  
  <p>Please help I am beginner in Struts2 and have basic knowledge of Struts only.</p>