Take the 2-minute tour ×

I have this secMarket.xml in my struts2 project, the code is below here:

<package name="secMarket" namespace="/foliofn">
    <action name="loans" class="tlc.ui.action.Loans" >

how can I get the namespace value "/foliofn" as a String in the "execute" method of action class tlc.ui.action.Loans?

share|improve this question

2 Answers 2

up vote 6 down vote accepted
  String namespace = ServletActionContext.getActionMapping().getNamespace();
share|improve this answer
you could also use ActionInvocation where necessary String namespace = invocation.getProxy().getNamespace(); –  gmjordan Jun 8 '13 at 17:21

If i may ask why do you need the namespace ? You can parse it from the request URI

Persumably your URI would look like this


share|improve this answer

Your Answer


