We already know when we create web content using Structues and Templates then Liferay Stores the data in xml format in content column of journalArticle table .If we want this data in our java code we can use SAX Parser .
Today we will discuss how to get this data in our jsp by using <x:parse> tag.
I already Created a Structure Mobile which contain 6 fields Brand,Model,Description,Camera, Price and image.
Now i create web contents Nokia Lumia using this structures .This data is save in journalarticle table as:-
The content column Store data in xml format as:-
So Now we can get this data using <x:parse> . Just use this code in your jsp:-
Explanation:-
1)We fetch the journalArticle using resourcePrimKey in scriptlets.
2)Then we parse the xml using <x:parse>
3)Finally we get the values using <x:out> and set in <c:set>.
4)For using <x> tags you must provide the entry in liferay-plugin-package.properties as:-
Output:-
Hope this will Help....
Related Post:-
No comments:
Post a Comment