Forums de discussion

using liferay-ui tags in a string

Beppo Ivel, modifié il y a 8 années.

using liferay-ui tags in a string

Regular Member Publications: 112 Date d'inscription: 09/04/14 Publications récentes
Hi there,

I transform a xml to html via xsl. For the html output I'm using
xmlns:liferay-ui="http://liferay.com/faces/ui"
to generate a string such as

<div xmlns:liferay-ui="http://liferay.com/faces/ui">
<liferay-ui:tabs names="Description, Creator, Associated Parties" refresh="false">
      <liferay-ui:section>
         				Text for Tab 1.
         			
      </liferay-ui:section>
      <liferay-ui:section>
         				Text for Tab 2.
         			
      </liferay-ui:section>
      <liferay-ui:section>
         				Text for Tab 3.
         			
      </liferay-ui:section>
   </liferay-ui:tabs>
</div>

Now I want to add this string to a jsp
&lt;%=mystring%&gt;
, but it seems that Liferay does not translate the ui tags in the render-phase. How to create a jsp from string during the action-phase?
thumbnail
Olaf Kock, modifié il y a 8 années.

RE: using liferay-ui tags in a string

Liferay Legend Publications: 6403 Date d'inscription: 23/09/08 Publications récentes
JSPs are compiled into servlets - if you generate a new JSP through XSL: Are you doing this at runtime or at development time?

JSPs should only be written during development time. If this is during runtime: Beef up your XML processing, so that you can insert your strings through XML means. You don't want to compile an extra JSP on every request, this would kill your server. Plus, runtime writeable JSP files are bad style and introduce quite some vulnerability-options.

All in all, to me your post looks like two totally unrelated questions:

  • I transform xml to html via xsl
  • I want to add a string to a jsp


If both indeed have nothing to do with each other: "Go ahead". If they do: See above.
Beppo Ivel, modifié il y a 8 années.

RE: using liferay-ui tags in a string

Regular Member Publications: 112 Date d'inscription: 09/04/14 Publications récentes
I have to do it at runtime, because I send a request to a external source and get a xml back and I want to include the infos of that xml in my view.jsp.
thumbnail
David H Nebinger, modifié il y a 8 années.

RE: using liferay-ui tags in a string

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
I've been doing this lately by adding a hidden div which contains all of the tags and acts like a "template". When I get a response or a click on an add button or something, grab the div using AUI and get the html() from the div. You can then append() it to an existing element (also found via aui). I've been doing this for 'tables' in a form so I sweep through the new elements fixing IDs and names.

Like Olaf said you can't render these things at runtime. But you can render them into a hidden div and use them as a template. Just have to fix up the template after it's applied (check your JS bindings, etc.).