Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Web content display portlet
I have a jsp file with some html content.In my site i need to have a portlet that has to display that html data in web content in liferay 7.For the site admin it should be editable and for non admin the same should be ineditable form.
i have a module project already and i need to create a new portlet in this.
Please let me know:
1. Do i need to create a normal portlet or see there any other way to create a portlet for displaying web content.
2. If i create a portlet and a page ...how add web content to that page.
3. How to add my jsp html content to the web content.Could you please help me out with this.
Thanks.
i have a module project already and i need to create a new portlet in this.
Please let me know:
1. Do i need to create a normal portlet or see there any other way to create a portlet for displaying web content.
2. If i create a portlet and a page ...how add web content to that page.
3. How to add my jsp html content to the web content.Could you please help me out with this.
Thanks.
harika suram:
I have a jsp file with some html content....
Counter-question: Is your question about the HTML content (which would have a CMS solution) or explicitly about it being delivered through a JSP (which I consider development time)?
harika suram:
1. Do i need to create a normal portlet or see there any other way to create a portlet for displaying web content.
The "Web Content Display" portlet displays Web Content Articles. If you answer "HTML" to my question above, you may use the built-in portlet. Note that through the Role Based Access Control, you can provide permissions to view/edit web content articles.
I'm treating your mention of "Web Content" as meaning Liferay's Web Content / Web Content Articles.
harika suram:
2. If i create a portlet and a page ...how add web content to that page.
Click the "Add" icon, find the "Web Content Display" portlet, click "Add" or drag&drop it to the page. Configure the portlet and choose the article you'd like to display in thig position.
harika suram:
For HTML: Edit Web Content Article (either through the Site Administration in the Product menu, or through the "Edit" option in the Web Content Display portlet right on the page.
3. How to add my jsp html content to the web content.
If you insist on JSP, I'd recommend no runtime change for a JSP. Other options that you have for creating more dynamic/scripted articles to replace JSP: You may use Web Content Templates (freemarker-based) to include some dynamic behavior.
I have created a web content for Global site.
I have two other sites
1. projectUser site and has userA(has projectUser role).
2. projectAdmin site and has userB(has projectAdmin role).
For both sites i have created private pages, added web content display portlet and then added the web content i created for global site.
But i need to give edit permission only for the userB and read permissions for userA.
In web content level permissions i tried to give permissions on role based. But it is not working i didnt see and edit permissions for userB.
Could you please help me out with this.
I have two other sites
1. projectUser site and has userA(has projectUser role).
2. projectAdmin site and has userB(has projectAdmin role).
For both sites i have created private pages, added web content display portlet and then added the web content i created for global site.
But i need to give edit permission only for the userB and read permissions for userA.
In web content level permissions i tried to give permissions on role based. But it is not working i didnt see and edit permissions for userB.
Could you please help me out with this.
Thank you, great info about web content and journal article.Now i am going to change the approach and would like to use the existing liferay web content dispaly portlet.
Let me simply my question here.
I add web content display portlet to my private page just by entering some text in the content.
I can able to see the same on my page. Worked!
Now i have html file with some div's, table and script. I want to display the same in my webcontent page.
Is there any way that i can attach my html page/ add html content directly to web content so that i can see the same in my page.
Let me simply my question here.
I add web content display portlet to my private page just by entering some text in the content.
I can able to see the same on my page. Worked!
Now i have html file with some div's, table and script. I want to display the same in my webcontent page.
Is there any way that i can attach my html page/ add html content directly to web content so that i can see the same in my page.
Well, one option would be to copy the content of the html page into a webcontent html edit field. But please note that this doesn't copy the styles, just the html markup.
Another option could be to use an Iframe. I rarely use it but sometimes it is handy. It will only work, if both pages, the one with the content and the one with the portlet are reachable by the user.
Another option could be to use an Iframe. I rarely use it but sometimes it is handy. It will only work, if both pages, the one with the content and the one with the portlet are reachable by the user.
Awesome!Everything worked for me as per my requirement.Would like to know few more thing.
1. If i create a site, page or web content in control panel it is only there in local system. How can i make them available in all other environment, so that other developers can also view.
2. How to check in site, page or web content i have created from control panel.
3. Need to know more about .lar files from you.
1. If i create a site, page or web content in control panel it is only there in local system. How can i make them available in all other environment, so that other developers can also view.
2. How to check in site, page or web content i have created from control panel.
3. Need to know more about .lar files from you.
harika suram:
You can use export/import, but it has some limitations. The Liferay versions have to be exactly the same, so such a lar file is always just a temporary solution. It can also be a bit tricky with Global categories, templates, Assets in other sites ...
1. If i create a site, page or web content in control panel it is only there in local system. How can i make them available in all other environment, so that other developers can also view.
But for simple environments exporting the site and importing it should work.
What we usually do is to "clone" the Liferay servers. So, we have a development server and when a new developer starts working on it, he copies the Liferay folder and the database to his local machine and works on the clone. Whenever there are major changes, we clone it again.
Nowadays we have dockerized most of our stuff, so the cloning process has become rather simple.
2. How to check in site, page or web content i have created from control panel.I assume that you mean in git (or a similar repository). Well, you can't. There is at least no OOB solution. You can export the lar files, unpack them and check in the xml contents (it's not fantastic, but could be enough for archiving purposes). You can also use the API to fetch contents.
It depends on your usecase.
e.g. we had a "hot phase" a while ago, where colleagues where doing a lot of cleanup and reorganization of sites. So, told them: Don't worry, I will create a database snapshot every hour. (I uses rsync on the document library, without syncing deletes to store the files) If you break something, call me and I will restore the db on the test system.
Lar Files are zip files. The problem is that the format is undocumented, internal and the content changes with every Liferay version. They can be used to transport sites/content from one system to the other, but they are not really useful for longtime storage or something like that.
3. Need to know more about .lar files from you.
On top of what Christoph says:
I consider Development servers to contain development content: It's not uncommon to use "Lorem Ipsum" or any of its variants in Development Machines.
David's old essay about distinguishing between developing code versus developing content is still applicable.
So I'd say: Don't bother. There are few cases where you want to know production content looks well, and that's for your custom developed code. Content is created and lives elsewhere, in your production machines, and potentially on one more authoring server (or environment)
I consider Development servers to contain development content: It's not uncommon to use "Lorem Ipsum" or any of its variants in Development Machines.
David's old essay about distinguishing between developing code versus developing content is still applicable.
So I'd say: Don't bother. There are few cases where you want to know production content looks well, and that's for your custom developed code. Content is created and lives elsewhere, in your production machines, and potentially on one more authoring server (or environment)
I have to disagree here somewhat. It is really helpful when developers can just work on the issue. It really speeds things up when you can give them a full environment, with nice pages, nice content, fully configured in the same way as production.
I found that the test content often does not behave the same as real content. Production often contains hundreds of articles with flags enabled/disabled, longer/shorter content. With preview image, without preview image.
I saw it several times that things went awry because the developer never tested all combinations.
You might say: But that's an issue for integration. Sure, it should be caught there. But the earlier, the better. When each developer already has the "normal" content on his machine, there is a pretty good chance that he catches issues when he initially implements a change/fix/feature.
I found that the test content often does not behave the same as real content. Production often contains hundreds of articles with flags enabled/disabled, longer/shorter content. With preview image, without preview image.
I saw it several times that things went awry because the developer never tested all combinations.
You might say: But that's an issue for integration. Sure, it should be caught there. But the earlier, the better. When each developer already has the "normal" content on his machine, there is a pretty good chance that he catches issues when he initially implements a change/fix/feature.
Christoph Rabel:
I understand where you're coming from. However, I'd rather have somewhat frequent restores of production backups in order to work on real content (note: with anonymization, might have some problems in regulated industries). This way I'll have truly what is being published, rather than having to publish certain content in all directions between all development and production systems. That's guaranteed to be a huge burden and get out of sync quickly.
I have to disagree here somewhat...
In principle, a development machine is rarely used to author content - it's there to author code. And while I might make some checks and demonstrations, I typically don't do bulk content editing on a development machine. And I recommend that nobody does.
Olaf Kock:
That's exactly what we are doing (in most cases). We clone prod to integration (it is pretty easy to script that) and int to dev. We delete all users except those belonging to certain groups (Admins, service users, ...) and depending on industry do a few other cleanup things like removing all files in certain folders, since files are either sensitive or sometimes huge.
I understand where you're coming from. However, I'd rather have somewhat frequent restores of production backups in order to work on real content (note: with anonymization, might have some problems in regulated industries).
We don't sync content, except for special cases. Maybe we would, if it was more reliable (e.g. export webcontent/pages in version 7.0.0 and still be able to import them in 7.0.6). Export/Import/Staging (remote or local) is somewhat "not fun". Well, maybe changelists will be nicer, I don't know yet.
Anyway, I believe, we share pretty much the same opinion here.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™