Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8635763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:03:24+00:00 2026-06-12T10:03:24+00:00

The requirement is as follows, When a new web content(corresponding to a particular structure,

  • 0

The requirement is as follows,

When a new web content(corresponding to a particular structure, say A) is published, it should automatically get updated on the Asset Publisher portlet (default functionality of Asset Publisher).

By default the Title of the web content is what appears as a link on the Asset Publisher for different web contents.
Instead of this I want the content of an element (say name) of structure A to appear as a link. Clicking on this link should open an Alloy UI Popup containing the corresponding Web content.

For this to happen I created a new ‘display style’ jsp using hooks (tweaked the abstracts.jsp).

Wrote this scriptlet in the .jsp:

<%
String personName=null;
JournalArticle journalArticle=null;
String myContent=null;
Document document = null;
Node node=null;
Node node1=null;
Node node2=null;
Node node3=null;
int noOfWords=0;
String pic=null;
String aboutMe=null;

double version=0;

try {
    version=JournalArticleLocalServiceUtil.getLatestVersion(assetRenderer.getGroupId(), "14405");
    journalArticle = JournalArticleLocalServiceUtil.getArticle(assetRenderer.getGroupId() , "14405",version);

    myContent = journalArticle.getContent();    

    document = SAXReaderUtil.read(new StringReader(myContent));        
    node = document.selectSingleNode("/root/dynamic-element[@name='personName']/dynamic-content"); 

    if (node.getText().length() > 0) {            
        personName = node.getText();        
    }    

    node1 = document.selectSingleNode("/root/dynamic-element[@name='pic']/dynamic-content");
    if (node1.getText().length() > 0) {         
        pic = node1.getText();
    }

    node2 = document.selectSingleNode("/root/dynamic-element[@name='noOfWords']/dynamic-content");
    if (node2.getText().length() > 0) {
        noOfWords = Integer.parseInt(node2.getText());        
    }

    node3 = document.selectSingleNode("/root/dynamic-element[@name='aboutMe']/dynamic-content");
    if (node3.getText().length() > 0) {            
        aboutMe = node3.getText(). substring(0,noOfWords)+"....";        
    }
} catch (PortalException e) {
    e.printStackTrace();
} catch (DocumentException e) {
    e.printStackTrace();
}
%>

But here the articleId needs to be hard coded.

I want to fetch the articleId here as and when a new web content is published i.e. dynamically.

Which API should be used here?

Any help is appreciated.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T10:03:26+00:00Added an answer on June 12, 2026 at 10:03 am

    This method works for me on the latest version of Liferay – Liferay 6.1.1 CE GA2, but I think it should works without any changes on previous versions too.

    Briefly, you could use getClassPK() method of the AssetEntry instance.

    In all of the display jsps you get asset entry as request attribute:

    AssetEntry assetEntry = (AssetEntry)request.getAttribute("view.jsp-assetEntry");
    

    And then to get latest version of journal article that’s associated with asset entry instead of using:

    double version = 
            JournalArticleLocalServiceUtil.getLatestVersion(assetRenderer.getGroupId(),
            articleId);
    JournalArticle journalArticle = 
            JournalArticleLocalServiceUtil.getArticle(assetRenderer.getGroupId(), 
            articleId, version);
    

    you could just write:

    JournalArticle journalArticle = 
            JournalArticleLocalServiceUtil.getLatestArticle(assetEntry.getClassPK());
    

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My requirement is as follows: I need to get the data from multiple text
Requirement I have an application with 2 activities, say A and B , with
Requirement is this ... We have our 3 web-applications deployed in RHEL-5 server, we
Requirement : Should update MySQL database with that of MS Sql Server updates which
I am new in C# and have requirement to retrieve a url from C#.
I have a web project that used to use Forms Authentication. I have new
I'm extremely new to Lex and the complete requirement of this problem is as
I don't have any experience in writing Requirement specification. I am writing a new
I have a small requirement and that is as follows: I am calling a
I wrote below code to satisfy program requirement as follows: Average of Three Write

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.