Skip to Content

How to get portal navigation path in English Locale ?

Hello Experts,

I need to fetch the current navigation path only in English, even if the locale of the portal in changed, in my JSPDyn project in NWDS.

I am using the following Javascript code for the job:

var pathArray = EPCM.getSAPTop().LSAPI.AFPPlugin.model.getCurrentSelectedPath();

var path = pathArray[0].getTitle() ;

for(var index = 1; index < pathArray.length; index++)

{

path = path +">" + pathArray[index].getTitle();

}

Since the code should be called in a JavaScript function I am unable to use the NavigationEventsHelperService API.

Please suggest if there is any way by which I can get the navigation path in EN Locale using EPCM API.

Thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Mar 25, 2015 at 07:01 AM

    Hello,

    1. Create a new servlet type component inside your portal component DC : -

    <component name="AjaxServlet">

    <component-config>

    <property name="ClassName" value="com.test.nodetranslation.AjaxServlet"/>

    <property name="ComponentType" value="servlet"/>

    <property name="SafetyLevel" value="authenticated_user"/>

    </component-config>

    </component>

    2. Inside this servlet, write below code to read a URL parameter, say, pageLaunchURL, and get it's title in EN: -

    String launchURL = request.getParameter("pageLaunchURL");

    IAdminBase adminBaseObj = (IAdminBase)iCtx.lookup(launchURL);

    IAttributeSet attrSet = (IAttributeSet)adminBaseObj.getImplementation( IAdminBase.ATTRIBUTE_SET );

    String objClass = attrSet.getAttribute(OBJECT_CLASS_PROPERTY);

    if("com.sapportals.portal.iview".equalsIgnoreCase(objClass)){

    String objectTitleEN = attrSet.getAttribute("com.sap.portal.pcm.Title", Locale.ENGLISH);

    }

    responseWriter.write(objectTitleEN);

    3. Call this servlet from your JSP using ajax call: -

    String servletUrl;

    %>

    <%

    servletUrl = ApplicationUtil.encodeURL(componentRequest,"mgi.de~ce~admin~np~wbtrends~portal.AjaxServlet");

    %>

    servletUrl = "<%=servletUrl%>";

    servletUrl +="?path="+iViewLaunchURL;

    var oXMLHttp = XMLHttpFactory.createXMLHttp();

    var resp;

    oXMLHttp.onreadystatechange = function (){

    if(oXMLHttp.readyState==4){

    resp= oXMLHttp.responseText;

    }

    }

    oXMLHttp.open("GET", servletUrl, false);

    oXMLHttp.send();

    In 'resp' object, you'll receive iView's title in EN language that was returned by Servlet.

    Hope it helps.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.