ActionContext.getContext().getName() http://www.opensymphony.com/webwork/api/com/opensymphony/xwork/ActionContext.html
? Martin ______________________________________________ Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung / Note de déni et de confidentialité This message is confidential. If you should not be the intended receiver, then we ask politely to report. Each unauthorized forwarding or manufacturing of a copy is inadmissible. This message serves only for the exchange of information and has no legal binding effect. Due to the easy manipulation of emails we cannot take responsibility over the the contents. Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Tue, 21 Apr 2009 13:14:46 -0400 > Subject: retrieving action name in ActionClass > From: bhaara...@gmail.com > To: user@struts.apache.org > > I have a JSP page that is very commonly used all throughout the application > (with minor tweaks). > > here is the snippet form struts.xml for it: > > <action name="ReportSelectionAction" > class="com.generate.web.action.reports.ReportSelection"> > <result>/reports/IncomeReportselection_struts2.jsp</result> > <result name="failure">login.jsp</result> > </action> > > The action class ReportSelection has bunch of getters/setters and logic in > it. The jsp that it goes to is IncomeReportselection_struts2.jsp. The JSP > has some labels that are specific to 'IncomeReport' If I want to make this > jsp general, I want to change to labels to something more specific to where > the action came from. > > is there a way to retrieve the action name in the action class?? like in the > above example, is there a way to retrieve action name > "ReportSelectionAction" in the "ReportSelection" class? > > Why I want to do that is that way I can set labels in the action class. > something like > > If (actionName.equals("ReportSelectionAction")) > setLabel1("Income Report"); > else if (actionName.equals("SomeOtherReportSelectionAction")) > setLabel1("Some Other Report Selection"); > > Then my struts.xml will have this. > <action name="ReportSelectionAction" > class="com.generate.web.action.reports.ReportSelection"> > <result>/reports/IncomeReportselection_struts2.jsp</result> > <result name="failure">login.jsp</result> > </action> > > <action name="SomeOtherReportSelectionAction" > class="com.generate.web.action.reports.ReportSelection"> > <result>/reports/IncomeReportselection_struts2.jsp</result> > <result name="failure">login.jsp</result> > </action> > > and in JSP IncomeReportSelection.jsp I can do <s:property value="label1"/> > > Is this a good approach or is there a better way to achieve this? > > Thanks _________________________________________________________________ Rediscover Hotmail®: Get quick friend updates right in your inbox. http://windowslive.com/RediscoverHotmail?ocid=TXT_TAGLM_WL_HM_Rediscover_Updates2_042009