Showing results for 
Search instead for 
Did you mean: 

get custom application name from frontname

0 Kudos

hi experts,

can you share how do i collect application name of a b2b webshop?

eg: application name is z_b2b, which login page is : host:port/z_b2b/b2b/

i need to capture z_b2b this... assumed available parameter is BusinessObjectManager bom white derived from user session...

the idea is different application would have different business implementations..



Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

You should be able to use the following in your action class :


request.getContextPath() will give you "/z_b2b" in your case


Edited by: Srikanth Sagiraju on Sep 1, 2011 10:44 PM

Former Member
0 Kudos

The closest you can get is the Application name which is read from the context constants defined in web.xml. b2b is returned when use the method getApplicationName() of any action extended from BaseAction.

Going by these lines, if you want to differentiate the applications, you may have to maintains a custom context variable in web.xml and read it where appropriate.

In any action class, that extends BaseAction you can use the method getInitParamaeter(String parameter) to get your values.

In any other class, to get com.zcompany.param you can use

String parameter="com.zcompany.param";
ServletContext ctx = getServlet().getServletConfig().getServletContext();
String myParam = ctx.getInitParameter(parameter);