Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
Jakub Liska
How to test / develop javascript components outside Portal ?
22 de Maio de 2011 14:01

Jakub Liska

Ranking: Regular Member

Mensagens: 187

Data de entrada: 25 de Março de 2010

Mensagens recentes


How do you guys test and develop JS components, that use Objects or variables (like Liferay.js, etc.) that are rendered / populated on serverside or some LR included JSPs ...which is only possible when request goes through MainServlet, ThemeUtil generates the Velocity template etc..... ?

In other words, the point is

- not having all the Velocity/Freemarker template ballast around your html/jsp when developing javascript component
- bypassing MainServlet / Portal is impossible because there is no other way to initialize javascript objects

So that :

- you cannot create a testing JSP/html and deploy it to another context on web server, because libraries needed by JSPs like `html/common/themes/top_head.jsp` are in ROOT context and javascript is initialized in them i think. Also you cannot do that in your portlet for this reason.

- you can create a Liferay hook and a dedicated jsp / html for JS development that will be accessible in here : `http://localhost:8080/html/portal/test.jsp` - but it is direct access, so that all those variables won't be initialized. You cannot even add a serlet mapping for that jsp via Hook, it supports only filter mapping...

- the last option that remains is doing that the portlet way and have a light theme for development that doesn't render anything but content of your portlet.

I bet that many of you is dealing with this issue.

Imagine that you are developing robust YUI / AUI components that are using JS objects like Liferay etc. that get initialized from server side variables. If I knew that before, I would have never used LR JS objects that are "rendered/populated" on serverside or initialized in those JSPs included, then I wouldn't have to deal with this issue.

Got any ideas ? This is really a great issue for me.