title: Java/Struts2: How to get action name from current url
body: <p>I am having a active page with  its  url like <code>http://localhost:8085/projectName/namespace1/namespace2/namespace3/sell.action?id=22</code></p>
  
  <p>Now i want get the  action name(4th name after the sign <code>/</code>) i.e setuppageforwared.</p>
  
  <p>How to achieve this ? Please help me to know because i read many books of struts2 i could not find anything which solve this problem.</p>
  
  <p>Before i was using PHP framework <code>codeigniter</code> which easily solve this type of problem using  <a href="http://ellislab.com/codeigniter/user-guide/libraries/uri.html" rel="nofollow">uri segment features(click here)</a>   . I am aspecting the same here in Struts2.</p>
  
  <hr>
  
  <p><em><strong>Given Url String</em></strong>: <code>http://localhost:8085/projectName/namespace1/namespace2/namespace3/sell.action?id=22</code></p>
  
  <p><em><strong>Expected Output</em></strong>: <code>sell</code></p>