Search code examples
javatagsliferayliferay-aui

liferay aui library tag


First I apologize for my noobiness in liferay.

When I use for example <aui:input label="EventName" name="EventName" type="text" /> tag in liferay jsp file that's ok and nothing goes wrong but when I want to generate the same input field using out.println It does not work.

out.println("<aui:input label=\"EventName\" name=\"EventName\" type=\"text\" />")

Is it liferay that can't handle this or what?

note:I can simply generate HTML codes without problem.For example this code works fine for me: out.println("<p>information for " +(i+1) + "th Guest:</p>" );

I use liferay 6.1.2 ce-ga3 and eclipse IDE.


Solution

  • This is not so much a question about Liferay, but rather about JSPs in general:

    JSP works in a way that the application server compiles the JSP into a servlet. During that process, the tags will be converted into actual Java code. This happens once (server side), and typically whenever the JSP changes. Compilation is static, and the browser will never see <aui:input .../>, rather it will see a rather elaborate <input .../>, probably with other decorations, javascript etc. that the aui tag generates.

    This is the reason why you can't generate tags for the JSP at runtime. At runtime you must generate pure HTML, as this is what the browser will understand.