lstrzelecki
lstrzelecki

Reputation: 671

Liferay only html and js

I have maven project which I want place as portlet in liferay. This portlet will be single page application (inside portlet). I want to deploy this portlet which contains only html, js, and css.

I want expose ./src/main/webapp/index.html and other files js, css, html without updating portlet.xml or liferay-portlet.xml.

Is it possible to expose all content inside src/main/webapp as static resources. As my starting point index.html. I dont't want use any jsp. Is there any easy solution for that?

I.e If I'll have index.html (src/main/webapp/index.html) and preview/invoices.js (src/main/webapp/preview/invoices.js). I want to put inside index.html and it will work. Without any additional configuration. Is it possible?

Upvotes: 0

Views: 1014

Answers (2)

Eduardo Pérez
Eduardo Pérez

Reputation: 488

The easiest way to use html, css and js (if the development is not big) is to use the content-viewer portlet and insert all ass the content in html format

If what you want is bigger and you want to have over source control and deploy as a portlet, using the liferay ide(or eclipse with the liferay plugin) is really easy to create a maven portlet and then edit the default jsp.

Regards

Upvotes: 1

Olaf Kock
Olaf Kock

Reputation: 48057

It seems like you didn't try this already: A portlet is nothing but a standard java web application with a few more deployment descriptors. Thus, your application is available as static resource out of the box. You won't gain anything from the portal integration if you don't go through portal URLs (e.g. who's the currently logged in user?), but you do totally can access all of your content from the browser.

In order to blend well into the portal, you should not render index.html out of the box but at least have a portlet with static HTML UI - reason is that a portlet is not supposed to include <html>, <head> and <body> markup, and out-of-the-box it doesn't have access to the head-section of your document where you might want to have css or js includes (same with the footer). With the portlet you can easily add your js to the end of the page and then go from there.

If you need information like the currently logged in user, their permissions etc., you should go through portal URLs instead of your webapp directly, because you'd just get the information you need this way.

"I want to integrate as a portlet without writing a portlet" sounds a bit like "I'd like to go swimming without getting wet". Make sure that this is not your case - a basic portlet (that delegates all of the implementation to JS) is no magic and not complex.

Upvotes: 1

Related Questions