Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Rupesh Chotai
Web content display with data from external system
February 27, 2013 1:04 PM
Answer

Rupesh Chotai

Rank: Regular Member

Posts: 163

Join Date: March 23, 2011

Recent Posts

Hi,
I have requirement to get data in my web content display from external system.
External system is exposing REST service and giving data in Json format. How can this be achieved in web content display?

Thanks in advance for replies.

Rupesh
Hitoshi Ozawa
RE: Web content display with data from external system
February 27, 2013 1:20 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7954

Join Date: March 23, 2010

Recent Posts

Did you read James blog?

http://www.liferay.com/ja/web/james.falkner/blog/-/blogs/yet-another-liferay-json-service-example
Rupesh Chotai
RE: Web content display with data from external system
February 28, 2013 1:38 PM
Answer

Rupesh Chotai

Rank: Regular Member

Posts: 163

Join Date: March 23, 2011

Recent Posts

Hi Hitoshi,
I read the blog and also updated code for 6.1 for example 3. However I couldn't figure out
1. where this implementation goes
2. how my web content will access data of json service
Hitoshi Ozawa
RE: Web content display with data from external system
February 28, 2013 3:43 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7954

Join Date: March 23, 2010

Recent Posts

Instead of asking me that, why not ask James who wrote the blog directly. He's the community manager here and should be reading most of the posts. emoticon
James Falkner
RE: Web content display with data from external system
February 28, 2013 5:54 PM
Answer

James Falkner

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1222

Join Date: September 17, 2010

Recent Posts

Rupesh Chotai:
Hi Hitoshi,
I read the blog and also updated code for 6.1 for example 3. However I couldn't figure out
1. where this implementation goes
2. how my web content will access data of json service


The blog post that Hitoshi refers to shows you how to retrieve web content articles from Liferay's WCMS using Liferay's JSON Web Services. Your use case is completely different, if I understand correctly.

You want to retrieve web content from some other system (not Liferay), in some JSON format, and render it as HTML within a Liferay page? Liferay can of course do this, but it doesn't really require the use of its WCMS. You just need some javascript to get the JSON and massage it into the desired HTML. You could do this with Liferay's WCM system but it would be like using IBM's "Watson" to compute the square root of 4 emoticon

Can you show us an example JSON object that you might retrieve from this system? Then we can show you how to show that in Liferay.
Gwowen Fu
RE: Web content display with data from external system
February 28, 2013 8:17 PM
Answer

Gwowen Fu

Rank: Expert

Posts: 280

Join Date: December 27, 2010

Recent Posts

Rupesh Chotai:
Hi,
I have requirement to get data in my web content display from external system.
External system is exposing REST service and giving data in Json format. How can this be achieved in web content display?

Thanks in advance for replies.

Rupesh


In your web content page, you can add Javascript to call the REST service and use Javascript to access the returned Json object and then update the content.
Rupesh Chotai
RE: Web content display with data from external system
March 1, 2013 8:30 AM
Answer

Rupesh Chotai

Rank: Regular Member

Posts: 163

Join Date: March 23, 2011

Recent Posts

Hi James,
You understood correct that I want to display Json data from external system into web content display.
I know using simple java script could do this, however, i want to give user CMS features of web content. So want to retrieve data in web content.

The JSON data look like
 1
 2{
 3    "NewsBulletin": {
 4        "newsBulletinBeanList": [
 5            {
 6                "newsId": "203",
 7                "newsTitle": "Test Title 1",
 8                "newsDescription": "test 1",
 9            },
10            {
11                "newsId": "202",
12                "newsTitle": "Test Title 2",
13                "newsDescription": "test 2",
14            }
15        ],
16        "flag": 1
17    }
18}


Can you please share how can I achieve this?
Thanks for your reply.
Rupesh Chotai
RE: Web content display with data from external system
March 1, 2013 8:31 AM
Answer

Rupesh Chotai

Rank: Regular Member

Posts: 163

Join Date: March 23, 2011

Recent Posts

Hi Gwowen,
Yes, I can do that. However, I want to give user CMS capability for this component so want to leverage those from web content display.
James Falkner
RE: Web content display with data from external system
March 1, 2013 8:59 AM
Answer

James Falkner

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1222

Join Date: September 17, 2010

Recent Posts

Rupesh Chotai:
Hi James,
You understood correct that I want to display Json data from external system into web content display.
I know using simple java script could do this, however, i want to give user CMS features of web content. So want to retrieve data in web content.

The JSON data look like
 1
 2{
 3    "NewsBulletin": {
 4        "newsBulletinBeanList": [
 5            {
 6                "newsId": "203",
 7                "newsTitle": "Test Title 1",
 8                "newsDescription": "test 1",
 9            },
10            {
11                "newsId": "202",
12                "newsTitle": "Test Title 2",
13                "newsDescription": "test 2",
14            }
15        ],
16        "flag": 1
17    }
18}


Can you please share how can I achieve this?
Thanks for your reply.


So you want to take those JSON objects and create real Web Content Articles in Liferay, for later display using the "Web Content Display" or "Asset Publisher" portlets? Or do you want to retrieve the JSON dynamically and immediately render it as HTML (but not create actual Web Content Articles within Liferay)?

If you want to create actual Web Content Articles, then you could execute a java application outside of Liferay, which reads the JSON, then creates articles inside of Liferay, then you'd need to add the Web Content Display or Asset Publisher portlets to a page to render them (and you'd also have to write a Web Content Structure and Template to associate them within the articles).

BTW, what's the 'flag' for?
Rupesh Chotai
RE: Web content display with data from external system
March 1, 2013 10:17 AM
Answer

Rupesh Chotai

Rank: Regular Member

Posts: 163

Join Date: March 23, 2011

Recent Posts

Hi James,
Thanks for quick reply.

I want to display that json data in web content display. So, lets take an example - I will be creating a web content display on a page. It has some table which should be populated with data from external system - which is essentially json string.

As I can understand from our reply --
If you want to create actual Web Content Articles, then you could execute a java application outside of Liferay, which reads the JSON, then creates articles inside of Liferay, then you'd need to add the Web Content Display or Asset Publisher portlets to a page to render them (and you'd also have to write a Web Content Structure and Template to associate them within the articles).

that I have to create web content display with json data from outside the liferay. Can you please elaborate more on this?

BTW, that flag is just for one of the business need.